From: noreply@... Date: 2005-09-04T07:47:40+09:00 Subject: [ ruby-Bugs-2371 ] Lexic confusion: method/local variable distinction works strange Bugs item #2371, was opened at 2005-09-04 00:40 You can respond by visiting: http://rubyforge.org/tracker/?func=detail&atid=1698&aid=2371&group_id=426 Category: Core Group: None Status: Open Resolution: None Priority: 3 Submitted By: Murphy (Kornelius Kalnbach) (murphy) Assigned to: Nobody (None) Summary: Lexic confusion: method/local variable distinction works strange Initial Comment: I know that Ruby keeps track of local variables while parsing, to allow simpler syntax. But I found a very surprising behaviour: class Foo def bar sym p sym end end foo = Foo.new bar = 308 # comment this out to make it work foo.bar :test # this fails: syntax error foo_bar :test # this is syntactically correct I think it is easy to see that foo.bar is a method, and certainly in a different scope than the bar local variable. Is it possible to say the parser: x.y is always a method, so expect parameters, as you would if no local variable "bar" existed. Changing this would probably break code; so if it is a bug, consider it a proposal for Ruby2. ---------------------------------------------------------------------- You can respond by visiting: http://rubyforge.org/tracker/?func=detail&atid=1698&aid=2371&group_id=426