Two optimizations
language_fan
foo at bar.com.invalid
Tue Jul 28 04:45:22 PDT 2009
Tue, 28 Jul 2009 04:53:02 -0400, bearophile thusly wrote:
> Such optimizations require brain and maybe even planning. So they have
> to be discussed first.
The discussion or collective community opinion won't help a bit. Walter
is the only person who decides what goes into the spec and what doesn't.
> If
> implemented correctly, the first optimization changes the running time
> enough to encourage a different programming style (for example Phobos2
> can be rewritten a lot, using just delegates instead of strings).
Functions that take functions as parameters can be dangerous for
readability since they allow adding custom control structures. I think
the idea in D has been to provide all possible control structures as
built-in features. For example foreach, foreach_reverse, soon we probably
get foreach_with_filter, foreach_parallel_for_2cores,
foreach_parallel_for_4cores etc.
The advantage of built-in features is that they remain compatible
everywhere. A third party library writer (e.g. tango developpers) may
create a tango_foreach_for_2cores and phobos group soon creates
phobos_foreach_for_2cores. And some game library designer might create
gamename_foreach_for_2cores. It's dangerous to give too much power to the
language users. And this is what happens if you start supporting these
'high order functions' with good optimizations. Cause it's possible to
optimize them too well with the knowledge we have today of programming
languages.
> Already done since few months, I fear. When people don't like me
> anymore, I'll leave. I'm not interested in a career in trolling.
The D developers are supposed to solve practical issues, not take part in
latest academic discussion.
>
> Bye,
> bearophile
More information about the Digitalmars-d
mailing list