From: Trans Date: 2007-06-20T06:24:06+09:00 Subject: Re: local vars clobbered by un-run code On Jun 19, 4:02 pm, Ian Whitlock wrote: > 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. One of things I always liked about Ruby is the fact the local vars and methods are, in a certain sens of the word, polymorphic. Where a method is being called, I can easily change it to be a variable. I don't have to go thru the code and remove ()s or vice versa. def chip "%s chip" end def good chip = "forget the %s chip" puts chip % "good" end So if you can do that, it would seem reasonable that one could do so conditionally as well. I find it odd that x is being setup as a local var before ever being assigned as such. That's quite declarative for a language that tends to shuns such things. T.