Beta D 2.069.0-b1

Iain Buclaw via Digitalmars-d-announce digitalmars-d-announce at puremagic.com
Sat Oct 10 07:17:32 PDT 2015


On 10 October 2015 at 14:51, Jacob Carlborg via Digitalmars-d-announce <
digitalmars-d-announce at puremagic.com> wrote:

> 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
>
>
It seems to be a misfeature of D to accept the equivalent of all three of
those examples as valid.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d-announce/attachments/20151010/968ec6d8/attachment.html>


More information about the Digitalmars-d-announce mailing list