[#25936] [Bug:1.9] [rubygems] $LOAD_PATH includes bin directory — Nobuyoshi Nakada <nobu@...>

Hi,

10 messages 2009/10/05

[#25943] Disabling tainting — Tony Arcieri <tony@...>

Would it make sense to have a flag passed to the interpreter on startup that

16 messages 2009/10/05

[#26028] [Bug #2189] Math.atanh(1) & Math.atanh(-1) should not raise an error — Marc-Andre Lafortune <redmine@...>

Bug #2189: Math.atanh(1) & Math.atanh(-1) should not raise an error

14 messages 2009/10/10

[#26222] [Bug #2250] IO::for_fd() objects' finalization dangerously closes underlying fds — Mike Pomraning <redmine@...>

Bug #2250: IO::for_fd() objects' finalization dangerously closes underlying fds

11 messages 2009/10/22

[#26244] [Bug #2258] Kernel#require inside rb_require() inside rb_protect() inside SysV context fails — Suraj Kurapati <redmine@...>

Bug #2258: Kernel#require inside rb_require() inside rb_protect() inside SysV context fails

24 messages 2009/10/22

[#26361] [Feature #2294] [PATCH] ruby_bind_stack() to embed Ruby in coroutine — Suraj Kurapati <redmine@...>

Feature #2294: [PATCH] ruby_bind_stack() to embed Ruby in coroutine

42 messages 2009/10/27

[#26371] [Bug #2295] segmentation faults — tomer doron <redmine@...>

Bug #2295: segmentation faults

16 messages 2009/10/27

[ruby-core:25942] Re: [Feature #2131] f(not x) => syntax error

From: Yukihiro Matsumoto <matz@...>
Date: 2009-10-05 14:52:26 UTC
List: ruby-core #25942
Hi,

In message "Re: [ruby-core:25937] [Feature #2131] f(not x) => syntax error"
    on Mon, 5 Oct 2009 15:13:35 +0900, "James M. Lawrence" <redmine@ruby-lang.org> writes:

|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

The last line is the point.  Although it seems just parentheses around
a multiple assignment, it really is a sequence of arguments, in which
third actual argument is an assignment to local variable c.  That
implies we have two usage of parentheses, one for expression grouping,
the other for method parameters.  They are same characters, but they
serve different roles.

|  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

In syntax rules, "not f a, b" is allowed, so that if we want to allow
the last case to be legal, the syntax must allow "f(not f a, b)" which
apparently an error.

|  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 think you're confusing parentheses for grouping and parentheses for
arguments.

							matz.

In This Thread