title: Why does Ruby not Symbol#=~ (regex match operator)?
body: <p>Ruby doesn't automatically stringify symbols when performing a regex match on them, which is easy to do when you have variables containing symbols and you forget that you need to call #to_s on them before trying a regex match:</p>
  
  <pre><code>&gt;&gt; :this =~ /./
  =&gt; false
  &gt;&gt; :this =~ :this
  =&gt; false
  &gt;&gt; :this =~ /:this/
  =&gt; false
  </code></pre>
  
  <p>It turns out that :=~ is defined in Object, Ruby 1.8's primordial class:</p>
  
  <p><a href="http://rubybrain.com/api/ruby-1.8.7/doc/index.html?a=M000308&amp;name==~" rel="nofollow">http://rubybrain.com/api/ruby-1.8.7/doc/index.html?a=M000308&amp;name==~</a></p>
  
  <p>Of course, the implementation just returns false, leaving it up to subclasses like String and Regexp to provide meaningful implementations.</p>
  
  <p>So why doesn't Symbol provide something like the following?</p>
  
  <pre><code>def =~(pattern)
    self.to_s =~ pattern
  end
  </code></pre>
  
  <p>Any Ruby linguists out there know?</p>