From: "David A. Black" Date: 2009-08-27T06:23:01+09:00 Subject: Re: ||= with 1.8 and 1.9 ? Hi -- On Thu, 27 Aug 2009, brabuhr@gmail.com wrote: > On Wed, Aug 26, 2009 at 3:46 PM, Rick DeNatale wrote: >> Right, the question is why in Ruby 1.9 is using the 'not a test' >> returned from the setter method in the case of ||= unlike Ruby 1.8.x >> and like itself in the = case: > > According the rubyspec project: > > language/variables_spec.rb: > describe "Operator assignment 'var op= expr'" do > it "is equivalent to 'var = var op expr'" do It isn't, though, at least in the ||= case (see Joel W.'s post). Matz's characterization of it to me at RubyConf (or somewhere) was: x ||= y same as x || x = y David -- David A. Black / Ruby Power and Light, LLC / http://www.rubypal.com Q: What's the best way to get a really solid knowledge of Ruby? A: Come to our Ruby training in Edison, New Jersey, September 14-17! Instructors: David A. Black and Erik Kastner More info and registration: http://rubyurl.com/vmzN