Petr Janda
2012-07-19 14:21:46 UTC
Hi,
I'm an occasional lurker on the D forums just to see where the
language is going,but I'm a little puzzled. In another thread I
found this code
auto r = [5, 3, 5, 6, 8].sort.uniq.map!(x => x.to!string);
I don't understand whats going on here. Int array is getting
sorted, then Uniqued, then what? What type is x? What kind of
operator is =>, why is x.to!string allowed template
specialization should say x.to!(string), which leads me to think
that there are multiple syntaxes for things(why I hate dynamic
languages, love compiled)
On another note, (copied from wikipedia)
foreach(item; set) {
// do something to item
}
what's with the lax syntax being allowed? Shouldn't it be at
least specified "auto item"?
I'm sorry I don't mean to be a criticizer, but it seems to me
that D is trying to be a dynamic-like compiled language way too
hard.
I'm an occasional lurker on the D forums just to see where the
language is going,but I'm a little puzzled. In another thread I
found this code
auto r = [5, 3, 5, 6, 8].sort.uniq.map!(x => x.to!string);
I don't understand whats going on here. Int array is getting
sorted, then Uniqued, then what? What type is x? What kind of
operator is =>, why is x.to!string allowed template
specialization should say x.to!(string), which leads me to think
that there are multiple syntaxes for things(why I hate dynamic
languages, love compiled)
On another note, (copied from wikipedia)
foreach(item; set) {
// do something to item
}
what's with the lax syntax being allowed? Shouldn't it be at
least specified "auto item"?
I'm sorry I don't mean to be a criticizer, but it seems to me
that D is trying to be a dynamic-like compiled language way too
hard.