Issue #2131 has been updated by James M. Lawrence.


09/23/2009 06:26 PM - Yukihiro Matsumoto:
>|This should have been classified as a feature request.
>|
>|Since (not x) is legal syntax, it is my opinion that f(not x) should be legal.
> 
>So, do you mean a,b,c = 1,2,3 is legal syntax, should we allow
>f(a,b,c = 1,2,3) ?

That (a,b,c = 1,2,3) and f(a,b,c = 1,2,3) contain different meanings
inside the parens does not really affect my argument.

  [0] + (a, b, c = 1, 2, 3)   # => [0, 1, 2, 3]
  
Whether that should mean [0, a, b, 1, 2, 3] or something else is a
different matter.

My point is that the parens serve to disambiguate,

  [0] + a, b, c = 1, 2, 3     # => syntax error
  [0] + (a, b, c = 1, 2, 3)   # => [0, 1, 2, 3]
  [0] + f a, b, c = 1, 2, 3   # => syntax error
  [0] + f(a, b, c = 1, 2, 3)  # => ok

  true | not false            # => syntax error
  true | (not false)          # => true
  true | f not false          # => syntax error
  true | f(not false)         # => syntax error

Why should the last case fail?  I also see no reason why

  f(class Foo;attr_accessor :x;end;Foo.new.x=5)  # => syntax error

should necessarily be illegal.  It's just f(5) with a side-effect.
The parens are fully capable of capturing the expression.

I can understand ignoring this bug report because I have not provided
a backward-compatible parse.y which handles these cases.

That it was rejected immediately implies no such parse.y can exist, or
that if it did then we wouldn't want it.  Which is it and why?

----------------------------------------
http://redmine.ruby-lang.org/issues/show/2131

----------------------------------------
http://redmine.ruby-lang.org