optional (), what is done elsewhere
Ary Borenszweig
ary at esperanto.org.ar
Mon Feb 4 11:21:36 PST 2013
On 2/4/13 2:10 PM, "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....
>
> Jerome
>
irb(main):001:0> foo (1, 2)
SyntaxError: (irb):1: syntax error, unexpected ',', expecting ')'
foo (1, 2)
^
Not ambiguous at all, it's a syntax error because (a, b) is not a valid
expression.
Ruby is... perfect :-P
More information about the Digitalmars-d
mailing list