Could D be used by Jonathan Blow rather jai language?

H. S. Teoh hsteoh at
Fri Nov 20 18:44:33 UTC 2020

On Fri, Nov 20, 2020 at 06:22:47PM +0000, Ethan via Digitalmars-d wrote:
> [...] whenever I try to do heavy compile time code in D (be it
> templates or CTFE) I'm constantly battling the compiler and the
> language to get it to do what I want it to do.

In spite of our enthusiasm (including my own) and our advertising D's
compile-time capabilities (templates/CTFE) as a major selling point, I
still reach for two-stage manual D code generation (i.e., write helper
program that prints D code) once my code passes a certain level of
complexity.  IME, darling D projects that heavily utilize CTFE and
templates like vibe.d's Diet templates, std.regex, etc., are painfully
slow to compile and use, despite their coolness factor.

I wouldn't reinvent my own diet templates or std.regex, of course, but
if I'm faced with a task that needs code generation on that level of
complexity or higher, I find it much more conducive to write a helper
program that spits out D code that's then compiled into the main
executable, rather than fight with superlinearly-growing compile times,
the compiler running out of RAM, and difficulty of debugging.

We have a ways to go indeed.

> (That's a sneaky way of saying "type functions when?")

There seems to be some resistance to the idea by Walter and Andrei.
Which is usually a bad sign for acceptance.  I suggested recognizing
certain template patterns and internally switching to a type function
implementation underneath, i.e., retain the current template semantics
and optimize the implementation, but Stefan didn't like that idea. So I

Do you have a concrete example of where type functions would do much
better than templates, that might serve as a good motivating example of
why type functions would be a good idea?


Notwithstanding the eloquent discontent that you have just respectfully expressed at length against my verbal capabilities, I am afraid that I must unfortunately bring it to your attention that I am, in fact, NOT verbose.

More information about the Digitalmars-d mailing list