From: Stefan Kaes Date: 2005-11-22T09:54:46+09:00 Subject: Re: semenatics of if/unless/while statement modifiers Eric Hodel wrote: > On Nov 21, 2005, at 4:37 PM, Stefan Kaes wrote: > >> Mauricio Fern�ndez wrote: >> >>> On Tue, Nov 22, 2005 at 08:22:59AM +0900, Stefan Kaes wrote: >>> >>>> Hi all, >>>> >>>> I found that >>>> >>>> if (variable = expr) >>>> ... do something with variable ... >>>> end >>>> >>>> works, whereas >>>> >>>> ... do something with variable ... if (variable = expr) >>>> >>>> doesn't. >>>> >>>> I can't find a good reason why these two forms differ in semantics. >>>> >>> >>> See [ruby-talk:166828]. >>> >>> >> And how do I get to [ruby-talk:166828]? > > > From the list archive: > > http://ruby-talk.org/ruby/ruby-talk/index.shtml > Thanks a lot. So this behaviour is caused by intermingling parsing with semantic analysis. Much like forward procedure declarations were required for old Pascal compilers. I hope this will be changed for Ruby 2.0, as it's an ugly wart on an otherwise very clean lanuage.