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
        • Re: Beta D 2.... Martin Nowak via Digitalmars-d-announce
          • Re: Beta ... Adam D. Ruppe via Digitalmars-d-announce
            • Re: ... Martin Nowak via Digitalmars-d-announce
            • Re: ... Adam D. Ruppe via Digitalmars-d-announce
            • Re: ... Meta via Digitalmars-d-announce
            • Re: ... Jonathan M Davis via Digitalmars-d-announce
            • Re: ... deadalnix via Digitalmars-d-announce
            • Re: ... Johannes Pfau via Digitalmars-d-announce
            • Re: ... Jacob Carlborg via Digitalmars-d-announce
          • Re: Beta ... Ola Fosheim Grøstad via Digitalmars-d-announce
          • Re: Beta ... Jacob Carlborg via Digitalmars-d-announce
            • Re: ... Iain Buclaw via Digitalmars-d-announce
            • Re: ... Ola Fosheim Grøstad via Digitalmars-d-announce
            • Re: ... deadalnix via Digitalmars-d-announce
            • Re: ... Ola Fosheim Grøstad via Digitalmars-d-announce
            • Re: ... Meta via Digitalmars-d-announce
            • Re: ... Ola Fosheim Grøstad via Digitalmars-d-announce
            • Re: ... Meta via Digitalmars-d-announce
            • Re: ... Ola Fosheim Grøstad via Digitalmars-d-announce
          • Re: Beta ... deadalnix via Digitalmars-d-announce
  • Re: Beta D 2.069.0-b1 anonymous via Digitalmars-d-announce

Reply via email to