title: Official expansion of ||= conditional assignment operator
body: <p>I want to emphasize I am looking for the <em>actual</em> way the <code>||=</code> operator is expanded by the Ruby 1.9.3 interpreter, not how it <em>appears</em> to be expanded based on its behavior.  What I'm really hoping for is someone who has grokked the actual interpreter source, a task which I sadly am probably not up to.  The only resource I have found that appears to examine this question is out of date: "<a href="http://dablog.rubypal.com/2008/3/25/a-short-circuit-edge-case" rel="nofollow">A short-circuit (||=) edge case</a>".</p>
  
  <p>The resource I mentioned above seems to suggest that the "official" expansion of <code>x ||= y</code> to <code>x = x || y</code> was either inaccurate or buggy in interpreter versions prior to 1.9.  In any case, the edge case indicated seems to have been smoothed out.  The resource above claims that <code>x || x = y</code> or <code>x or x = y</code> are "more accurate".  Neither of those, however, is correct, because they don't work when <code>x</code> is a previously undeclared global variable:</p>
  
  <pre><code>[11:04:18][****@asha:~]$ irb
  1.9.3-p194 :001 &gt; a || a = 3
      NameError: undefined local variable or method `a' for main:Object
  1.9.3-p194 :002 &gt; b or b = 3
      NameError: undefined local variable or method `b' for main:Object
  1.9.3-p194 :003 &gt; c = c || 3
      =&gt; 3 
  </code></pre>
  
  <p>So in 1.9.3, at least, the <code>x = x || y</code> expansion <em>appears</em> to be correct, as far as these examples are concerned.  However, to reiterate my original point, I would really like to see some truly authoritative source resolve this question, well, authoritatively rather than anecdotally as I (and others) have done.</p>