From: dblack@... Date: 2007-09-03T21:37:11+09:00 Subject: Re: assigning to hash keys when there is a default value? Hi -- On Mon, 3 Sep 2007, Morton Goldberg wrote: > On Sep 3, 2007, at 7:37 AM, dblack@wobblini.net wrote: > >> The only possible explanation I can come up with, which I don't like, >> is that: >> >> h[2] ||= 10 >> >> is being treated like: >> >> 5 = 5 || 10 >> >> which is just another can of worms. > > I don't want to believe that because it raises the question of why > > h[2] = 10 > > isn't treated as > > 5 = 10 > I mean, I simply can't believe the Ruby interpreter would treat h[2] as a > simple rvalue in h[2] ||= 10. I agree -- it definitely wouldn't. It was a kind of reductio ad absurdum. David -- * Books: RAILS ROUTING (new! http://www.awprofessional.com/title/0321509242) RUBY FOR RAILS (http://www.manning.com/black) * Ruby/Rails training & consulting: Ruby Power and Light, LLC (http://www.rubypal.com)