Just where has this language gone wrong?

Brad Anderson eco at gnuk.net
Thu Jul 19 08:30:57 PDT 2012


On Thu, Jul 19, 2012 at 9:20 AM, Brad Anderson <eco at gnuk.net> wrote:

> On Thu, Jul 19, 2012 at 9:03 AM, Petr Janda <janda.petr at gmail.com> wrote:
>
>>  It's just syntax. Eliminating syntax noise is fine. Code should look
>>> like what it does.
>>>
>>
>> Not if "eliminating noise" equals to making things harder to understand.
>>
>> When you say (int x) { return x; } it's clear about what it is, a
>> _function_ without name.
>>
>
> Nothing is stopping someone from being explicit with their types like
> that, of course.
>
> Here is the original code written in a way that is probably more familiar
> to you:
>
> auto r = map!((int x) { to!(string)(x); })(uniq(sort([5, 3, 5, 6, 8])));
>
>
Ehm...forgot the return:

auto r = map!((int x) { return to!(string)(x); })(uniq(sort([5, 3, 5, 6,
8])));


> Personally I find the original version to be much more readable but that
> does require a basic knowledge of D's syntax. People coming from other
> languages are free to use the more classic way if they wish.  It's better
> to learn idiomatic usage of a language, though, instead of forcing it to be
> a language you are more comfortable in.
>
> Regards,
> Brad Anderson
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20120719/73ba372b/attachment.html>


More information about the Digitalmars-d mailing list