Hi,
In message "[ruby-talk:21025] A parsing bug in 1.7.1?"
on 01/09/10, Aleksi Niemel<aleksi.niemela / hex.fi> writes:
|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
As a general rule, don't put spaces between method names and
parenthesis in Ruby.
|Why I'm filing this in the first place is that all of the above works
|with 1.6.4 so there might be some regression here, or a deliberately
|made choice for grammar change. In either case it might be good to raise
|public awareness.
|
|In any case it's nice to note array notation doesn't go along nicely as
|expected (by a novice) with small whitespace adjustments. So
|
| [foo ("bar"), 2] is expected to be [(foo("bar")), 2] by a novice
| whereas it's actually [(foo("bar", 2))], while
| [foo("bar"), 2] parses always as the expected one.
I will try to fix this. But I still recommend to follow the above rule.
matz.