Excerpts from Ryan Davis's mail of 16 Feb 2005 (EST):
> Use ParseTree and you can see why!!!
> 
> <576> echo "a=/blah/; 's' =~ a" | parse_tree_show -f
> (cut for readability)
>      [:lasgn, :a, [:lit, /blah/]],
>      [:call, [:str, "s"], :=~, [:array, [:lvar, :a]]]]]]]]
> <577> echo "'s' =~ /blah/" | parse_tree_show -f
> (cut for readability)
>      [:match3, [:lit, /blah/], [:str, "s"]]]]]]]

Very nice answer.

Like the original poster, I found the behavior counterintuitive. Perhaps
this is because our assumptions come from the C model of the universe,
where more local variables is typically faster, and method dispatch is
not a problem.

I wonder what the merits of collecting equivalences like these to form
some kind of post-hoc parse-tree optimization would be. Probably not
great, but it might be fun.

-- 
William <wmorgan-ruby-talk / masanjin.net>