Beta D 2.069.0-b1
Jacob Carlborg via Digitalmars-d-announce
digitalmars-d-announce at puremagic.com
Sat Oct 10 05:51:42 PDT 2015
On 2015-10-10 03:52, Martin Nowak wrote:
> Scala and Ruby seem to do well with sloppy parens.
A few notes about why Ruby doesn't have the same problems as D has:
1. Ruby has optional parentheses for all method calls, regardless if
they accept arguments or not
2. Ruby has a different syntax for calling lambdas from calling functions:
def foo
end
foo() # calling function
a = -> { }
a.call # calling lambda
a.() # alternative syntax for calling lambda
In Ruby, no one will ever use empty parentheses for calling a method.
3. You can not use the setter syntax for a "regular" method taking one
argument:
class Foo
def bar(a)
end
def foo=(a) # not the same name as "foo"
end
end
a = Foo.new
a.bar = 3 # error
a.foo = 3 # ok
a.foo(3) # error
--
/Jacob Carlborg
More information about the Digitalmars-d-announce
mailing list