in reply to Re: Favorite programming language, other than Perl:
in thread Favorite programming language, other than Perl:
When Ruby sees a name such as ``a'' in an expression, it needs to determine if it is a local variable reference or a call to a method with no parameters. To decide which is the case, Ruby uses a heuristic. As Ruby reads a source file, it keeps track of symbols that have been assigned to. It assumes that these symbols are variables. When it subsequently comes across a symbol that might be either a variable or a method call, it checks to see if it has seen a prior assignment to that symbol. If so, it treats the symbol as a variable; otherwise it treats it as a method call.So if I add a local variable "foo", it can silently mask subsequent calls to a function "foo" that I've been happily calling for a month? Yikes. Sure, Perl has some wierd things going on in places, but they mostly just show up in golf games.
/s
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: (OT -- ruby) Re: Re: Favorite programming language, other than Perl:
by elusion (Curate) on May 11, 2002 at 02:33 UTC | |
by educated_foo (Vicar) on May 11, 2002 at 03:09 UTC | |
by elusion (Curate) on May 11, 2002 at 13:44 UTC |