Quoting Terence Parr <parrt / cs.usfca.edu>:

> Let me second the idea that whitespace should not change the
> meaning of a construct...bad enough that it's context-sensitive
> (and lexically not via flow analysis) so that foo can be a
> function call or var ref.  ick.

I don't agree about whitespace in this case -- I think it's fine
that foo[1] and foo [1] parse differently to one another given that
Ruby otherwise uses whitespace to signal the start of an argument
list (and that too I think fine).

However, the context-sensitivity is a problem.  Speaking of context,
I neglected to include some when I CCed the grammarians list.

What Matz is proposing for Ruby2.0 is that the criteria for a name
being treated as local variable would change from "assignment
appearing anywhere prior to the point in question" to "assignment
appearing anywhere within the same method/scope/etc".

So, rather than:

 def foo
   n # method
 end

 def hoge
   n # method
   n = 1
   n # variable
 end

We get:

 def foo
   n # method
 end

 def hoge
   n # variable
   n = 1
   n # variable
 end

I think that's a good idea -- at least, it would be if there weren't
ambiguities in the grammar that would consequently require multiple
passes or backpatching the AST to resolve.

So, just for to-day, I am putting on my prescriptivist hat.  We'll
have to defer to Matz's ultimate decision, but I hope I can
persuade him to address the ambiguities for 2.0.

-mental