foreach thoughts
bearophile
bearophileHUGS at lycos.com
Tue Jan 14 01:55:41 PST 2014
Manu:
> So, the last few days, 2 things have been coming up constantly.
>
> foreach is like, the best thing about D. But I often get caught
> by 2 little
> details that result in my having to create a bunch more visual
> noise.
I am against the suggested changes, because they are too much
not-orthogonal.
One of the few things that I'd like to change in foreach is
support for anonymous loops: foreach(;0..10)
I'd like an enumerate() in Phobos.
I think the current tuple unpacking in foreach is a very limited
and partially broken feature that should be deprecated as soon as
possible (and later replaced with something better and more
general).
I think the ! for algorithms and ranges add noise, sometimes I
forget them, and I'd like to not need them, but I think they are
not going away. So what I'd like are more specific and more clean
error messages when I forget them.
As D programs use more and more algorithm UFCS chains, D
compilers will need to optimize that kind of code better, adding
specific high-level and mid-level optimizations (rewrite rules,
deforestations, etc).
Bye,
bearophile
More information about the Digitalmars-d
mailing list