bearophile Wrote: > Regarding expression templates in C++ and D there is something to be > considered (this was probably already discussed in past, but probably not by > me). D is or hopes to become a language quite fit for numerics processing > too. Features like vectors ops, multiple dimensional dollars symbols, array > slicing, inline assembly, string mixins, operator overloading, some support > for parallelism, etc, and the general low-level nature of its C roots, make > it good (or acceptable) for heavy numeric processing on the CPUs (and maybe > acceptable on the GPUs too). > > C++ template meta-programming looks hard to, but part of the complexity comes > from the syntax, weird semantics corner cases, cheap limitations etc. If you > translate some C++ template meta-programming code with a functional language, > you see how much semantically easy most of that C++ code is. C++ template > syntax is a kludge. D templates improve the situation some and remove some > wizardry from C++ templates; I have learnt to use D templates in a relatively > short time. > > Similarly, there's some need for active libraries like Blitz++, that improve > performance of the numeric code doing with library code some of the > optimizations done by Fortran compilers (Blitz++ performs tiling, reordering, > collapsing, unit stride optimizations, etc.). As with template > meta-programming, such optimizations are not very complex, but they become > wizardry if you have to implement them with C++ templates (and maybe with D > templates too). > > So is D going to somehow help the implementation of those optimizations, or > is this need too much niche to deserve this work?
You are right, D's templates are very similar to C++'s templates modulo syntactic improvements, static if, and so on. However this discussion should be tagged with D 3.0. The feature set of D 2.0 is already set in stone. The only way to improve this is via library addons. You could try writing patches. Maybe a set of abstraction templates would help developing better metaprograms?
