On Thu, Jul 19, 2012 at 9:20 AM, Brad Anderson <e...@gnuk.net> wrote:
> On Thu, Jul 19, 2012 at 9:03 AM, Petr Janda <janda.p...@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 >