optional (), what is done elsewhere

Jacob Carlborg doob at me.com
Mon Feb 4 23:17:53 PST 2013


On 2013-02-04 18:10, "Jérôme M. Berger" wrote:
> deadalnix wrote:
>> 1/ Ruby.
>>
>> In Ruby, method are called without (). This is not ambiguous as
>> fields are always private.
>>
> 	Note that in Ruby, this line:
>
> foo(1, 2)
>
> 	Means something different than:
>
> foo (1, 2)
>
> 	That may not be ambiguous for the computer, but it sure is for the
> programmer....

For Ruby 1.8.7 I get this result:

[1] pry(main)> def foo (a, b); p a; end
=> nil
[2] pry(main)> foo(1, 2)
1
=> nil
[3] pry(main)> foo (1, 2)
(pry):3: warning: don't put space before argument parentheses
1
=> nil

I get a warning but I do get the same result. Using Ruby 1.9.x it's as 
Ary said, it's a syntax error.

-- 
/Jacob Carlborg


More information about the Digitalmars-d mailing list