Hello -- On Mon, 10 Sep 2001, [iso-8859-1] Aleksi Niemelwrote: > I encountered a possible parsing bug in latest nightly snapshot Ruby > 1.7.1. > > These work and don't work almost randomly :) : > > [foo("bar")] works > [foo("bar"),] works > [foo ("bar")] works > [foo ("bar"),] doesn't work > [foo ("bar"), foo("bar")] works > [foo ("bar"), foo("bar"),] doesn't > > The reason for "doesn't work" is that 'foo ("bar"),' is parsed as a > method call and doesn't work for the same reason > > foo(3,) > > doesn't work (expecting more arguments, as there's no optional comma at > the end of the arguments list in the grammar). Just to add to the picture: there are two (I believe contradictory) warnings issued: candle:~$ /usr/local/lib/ruby-cvs/bin/ruby -v ruby 1.7.1 (2001-07-15) [i586-linux] candle:~$ /usr/local/lib/ruby-cvs/bin/ruby -w def foo; end [foo ("bar"),] -:2: warning: foo (...) interpreted as method call -:2: warning: foo (...) interpreted as command call -:2: parse error The first warning is wrong: as Aleksi says, it isn't "foo (...)" but "foo (...)," that's being interpreted as a method call. (If it were just the "foo (...)" part, then then comma would presumably be parsed as it is in the second example.) David -- David Alan Black home: dblack / candle.superlink.net work: blackdav / shu.edu Web: http://pirate.shu.edu/~blackdav