From: brabuhr@... Date: 2009-08-27T07:03:24+09:00 Subject: Re: ||= with 1.8 and 1.9 ? On Wed, Aug 26, 2009 at 5:23 PM, David A. Black wrote: > Hi -- > > On Thu, 27 Aug 2009, brabuhr@gmail.com wrote: >> 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 Yeah, that version matches my mental model. x ||= y x = x || y x || x = y x += y x = x + y x + x = y # :-) o.x ||= y o.x = o.x || y # .x= is always called o.x || o.x = y # .x= is not always called o.x += y o.x = o.x + y Then maybe ||= and += should be split apart in rubyspec: describe "var += expr" it "is equivalent to 'var = var op expr'" describe "var ||= expr" it "is equivalent to 'var || var = expr'"