From: Caleb Clausen Date: 2009-07-22T08:26:35+09:00 Subject: [ruby-core:24489] Re: [Bug #1801] parse error on variable/method collision Yukihiro Matsumoto wrote: > Ah, sorry for my weak memory. I remember the conversation now. > Now it's a issue of trade off, between compatibility and > intuitiveness. While you're trying to decide if this ought to be changed or not, let me ask about a similar case. I don't know ruby's parser that well, and I can't decide if this is a different manifestation of the same bug (if the first is determined to be a bug, that is), or just a highly similar bug, maybe you or someone else here can enlighten me: p = p m %(2) I think the %(2) should be treated as a string, since it is in all other cases I know of (unless m is an lvar, which obviously it isn't here). However, it gets parsed as an operator and a parenthesized numeric literal. In this variation of the expression, %(2) is a string, as I expect: p m %(2) Is this the same bug (if it is to be a bug)? Should I file a new report? This expression works as I expected for versions 1.4.0 thru 1.7.1. All versions after 1.7.1 don't work the way I expect. In versions before 1.4.0 it causes a syntax error. Jruby has identical behavior as recent mri rubies. In rubinius, it causes a stack dump. Something interesting happened around about 1.7.1. (ruby-versions.net sure is useful. I've used it 3 times today.) I showed you this expression before as well; you said then that this one is a bug too. I recall that when I showed these examples to you and Charles Nutter, both of you then went on to come up with a series of more elaborate cases which exhibit.... interesting behavior. I couldn't follow what either of you were doing after the first couple of passes, but I wish I had those more elaborate examples so I could add them to my test suite.