List Info

Thread: Method call syntax




Method call syntax
user name
2006-05-08 20:48:13
Just noticed someone had written this on wikipedia:

"Omission of parentheses around method arguments may
lead to unexpected 
results. Note that the Ruby developers have stated that
omission of 
parentheses may be disallowed in future Ruby
versions..."

Is this true? I've been unable to find any reference to the
alleged 
unexpected results.


mathew

Method call syntax
user name
2006-05-09 05:10:28
Hi,

In message "Re: Method call syntax"
    on Tue, 9 May 2006 05:48:13 +0900, mathew <metapobox.com> writes:

|"Omission of parentheses around method arguments may
lead to unexpected 
|results. Note that the Ruby developers have stated that
omission of 
|parentheses may be disallowed in future Ruby
versions..."
|
|Is this true? I've been unable to find any reference to
the alleged 
|unexpected results.

It's in fact: 

 Omission of parentheses around method arguments for method
calls in
 the argument list may make programs hard to read / parse.

for example,

  p sprintf "the answer=%d\n",42

warns like "warning: parenthesize argument(s) for
future version", and
recommended code should be

  p sprintf("the answer=%d\n",42)

							matz.

Method call syntax
user name
2006-05-09 13:01:44
On May 9, 2006, at 12:10 AM, Yukihiro Matsumoto wrote:

> Hi,
>
> In message "Re: Method call syntax"
>     on Tue, 9 May 2006 05:48:13 +0900, mathew
<metapobox.com> writes:
>
> |"Omission of parentheses around method arguments
may lead to  
> unexpected
> |results. Note that the Ruby developers have stated
that omission of
> |parentheses may be disallowed in future Ruby
versions..."
> |
> |Is this true? I've been unable to find any reference
to the alleged
> |unexpected results.
>
> It's in fact:
>
>  Omission of parentheses around method arguments for
method calls in
>  the argument list may make programs hard to read /
parse.
>
> for example,
>
>   p sprintf "the answer=%d\n",42
>
> warns like "warning: parenthesize argument(s) for
future version", and
> recommended code should be
>
>   p sprintf("the answer=%d\n",42)

But you are still planning to allow them to be dropped in
the non- 
ambiguous cases, right?  I notice you didn't add
parenthesis to the p  
call above and I think it would be sad if we had to start
writing:

   whatever.dup()

James Edward Gray II


Method call syntax
user name
2006-05-09 19:08:45
Hi,

Am Dienstag, 09. Mai 2006, 14:10:28 +0900 schrieb Yukihiro
Matsumoto:
> In message "Re: Method call syntax"
>     on Tue, 9 May 2006 05:48:13 +0900, mathew
<metapobox.com> writes:
> 
> |"Omission of parentheses around method arguments
may lead to unexpected 
> |results. Note that the Ruby developers have stated
that omission of 
> |parentheses may be disallowed in future Ruby
versions..."
> 
>  Omission of parentheses around method arguments for
method calls in
>  the argument list may make programs hard to read /
parse.
> 
> for example,
> 
>   p sprintf "the answer=%d\n",42
> 
> warns like "warning: parenthesize argument(s) for
future version", and
> recommended code should be
> 
>   p sprintf("the answer=%d\n",42)

I wouldn't mind to take account of a precedence rule, at
best as it currently is. I'm rather annoyed by encountering
these warnings all the time.

Probablyi, I'm not considering some parsing difficulty.

Bertram


-- 
Bertram Scharpf
Stuttgart, Deutschland/Germany
http://www.bertram-scha
rpf.de

[1-4]

about | contact  Other archives ( Real Estate discussion Medical topics )