From: Ian Whitlock Date: 2007-06-20T05:02:41+09:00 Subject: Re: local vars clobbered by un-run code Trans wrote: > > Don't tell me, it's some quirk of the way Ruby works. Sure looks like > a bug though. Just in case: > > ruby 1.8.4 (2005-12-24) [i486-linux] > > Hmm... I just got a dejavu. Maybe I came across this before. > > T. T all you showed is that sometimes the programmer must be responsible for knowing whether he wants to reference a function or a variable. Consider: def x 1 end p x #recognize function call without parens if false x = x() + 1 #variable x is created when code parsed end p x #reference the variable x which is nil because no assignment was made p x() #if the above were the function, how would you reference the variable? Result: 1 nil 1 Ian -- Posted via http://www.ruby-forum.com/.