[LRUG] An interesting Ruby hash semantics gotcha

David A. Black dblack at rubypal.com
Thu May 8 04:59:52 PDT 2008


Hi --

On Wed, 7 May 2008, Matthew Willson wrote:

> Now, I'm sure there's a reason Matz didn't do it this way - perhaps a 
> performance reason, perhaps a gotcha that I haven't noticed with my approach. 
> Perhaps it'll be fixed in 1.9.

It appears to be:

irb(main):010:0> {}.hash
=> 0
irb(main):011:0> { {} => true, {} => false }
=> {{}=>false}

(That's 1.9.0 as of April 30.)


David

-- 
Rails training from David A. Black and Ruby Power and Light:
   INTRO TO RAILS         June 9-12            Berlin
   ADVANCING WITH RAILS   June 16-19           Berlin
   INTRO TO RAILS         June 24-27           London (Skills Matter)
See http://www.rubypal.com for details and updates!



More information about the Chat mailing list