From: Robert Klemme Date: 2011-01-26T23:06:49+09:00 Subject: Re: The finer points of postfix conditionals. On Wed, Jan 26, 2011 at 1:59 PM, Jon Leighton wrote: > Robert Klemme wrote in post #977599: >> On Tue, Jan 25, 2011 at 7:09 PM, Jon Leighton >> wrote: >>> regardless of the cause and effect it is still surprising (to me) that >>> the two conditional syntaxes have different semantics :) >> >> Why do you find that surprising? > > I guess I expected that the two different concrete syntaxes would be > transformed into the same AST node. But that would lead to a situation where a local variable declared in an if or else branch of a regular "if" would be detected as defining the variable before the condition. Then one would consequently have to recognize all local variables in scope because otherwise the language rules would be too complex to understand and thus error prone. But if you do that you get tree traversal again vs. the simple start from "def" and record all local variables found so far. Kind regards robert -- remember.guy do |as, often| as.you_can - without end http://blog.rubybestpractices.com/