A nice way to step into 2012

bearophile bearophileHUGS at lycos.com
Wed Dec 28 14:57:29 PST 2011


deadalnix:

> bearophile:
>> In my opinion the most important reason for the introduction of
>> this anonymous function syntax is that it makes D functional-style
>> code (and generally code that uses lot of callbacks) less noisy,
>> so it makes it more easy to write and read.

> Both argument are fallacy. Javascript is a successful language (even if
> some design decisions are arguably very bad). It use a lot of callback,
> and promote event drivent programming so this type of consrtruct is used
> everywhere. In addition, in Javascript, code source size matters.
> 
> The syntax to do such a thing is more verbose in javascript. So
> definitively, this is a nice syntax, but this isn't that ground
> breaking, and this isn't even required for people to use this type of
> constructs.

Javascript is successful mostly for being the only language available on a very important platform, not for its many qualities and features. D lacks a killer app still, and it exists in an already mature ecosytem dominated by other languages like C++. So it has to compete on different grounds of quality.

I agree the new short lambda syntax is not necessary, but it's good to have. I have written a good amount of functional-style code in D2 (while I have not written a significant amount of functional-style code in Javascript), I have written some code in OCaML and Haskell, and I have seen that the amount of parentheses and brackets in such D code make it not easy to write and read for me, compared to equivalent code in more functional languages. So you need to try harder if you want to change my mind :-)

Bye,
bearophile


More information about the Digitalmars-d mailing list