On Wednesday, 17 June 2015 at 05:09:54 UTC, Jonathan M Davis
wrote:
On Tuesday, 16 June 2015 at 20:57:03 UTC, Walter Bright wrote:
Use of expression templates in C++ to implement DSLs is
probably some of the most awful code ever conceived.
A lot of things in C++ are ill-conceived, but templates were not
designed to do things like that. So the language does not endorse
it.
Mal-features like string-mixins and multiple-alias-this endorse
writing ugly code. Those are deliberate features. And it is
actually worse than Javascript...
Whereas string mixins allow us to do all kinds of crazy stuff
with DSLs if you want to - but they're clearly confined in
strings where you're not going to mistake them for normal D
code. It's _very_ cool how Pegged is able to take a grammar in
normal, PEG format, and generate a parser from it. But
attempting anything like that with expression templates would
have been horrible.
I've noticed that a key difference between D and Javascript
programmers is that the latter group through-and-through
acknowledge that eval() is a problematic feature.