bearophile wrote:
grauzone:
Why did you choose to do it like this? Because it is shorter, or
for performance (avoid delegate call)?
I agree with the general points you have made. Alex has used aliases
for performance.
My dlibs (for D1) use closures, I like them. Extensive benchmarking
of mine have shown me they are often fast enough. In the spots of the
program where you need max performance I just don't use them, and I
use normal D code. The good thing is that such critical spots are
often 2-5-20% of the lines of the whole program, so for me improving
safety and syntax was a win.
It is hard to hit just the right tradeoff between performance and
simplicity. One motivating issue, however, is we don't want to leave an
excuse or desire to go back to C or C++ for performance reasons, even if
those reasons are not reality.
On the other hand, I really like the string mixin approach, I think it
works simply and elegantly for most predicates.