language_fan wrote:
Thu, 24 Sep 2009 21:13:48 +0200, downs thusly wrote:

language_fan wrote:
Thu, 24 Sep 2009 13:47:21 -0400, Steven Schveighoffer thusly wrote:

I actually prefer the compiler to handle the casting versus templates
to cut down on template instantiation bloat.
I wonder how D scales to 100 MLOC programs as the template
instantiations can be troublesome already in < 1000 LOC programs.
We write templates in < 1000 LOC programs to avoid having to write 100
MLOC :)

Also, let me categorically state: if you're writing 100MLOC programs,
you're doing it horribly, horribly wrong.

No conceivable program possibly requires that much logic.

I agree, usually there is *something* wrong with your program if it gets that large. I personally do not consider programs of that size very reliable. But the thing is, you probably know that people fear template instantiations. Not only can they cause really weird linking bugs, the more templates you have, the larger the executables get. Also as dmd does not use garbage collection (yet?) during compilation, the instantiations can easily kill the compilation process.

Sometimes templates are abused to do what macros were supposed to by used for. I can imagine that templates can cause problems much sooner, you do not even need 1 MLOC of code to do that. Apparently D will never get a powerful macro system since the focus is on other features and templates seem to work just fine on the small scale.

That's not the reason.
A bit of history: A macro system was planned for D2, and 'macro' was made a reserved word. But in discussions at the end of the first D conference, I demonstrated that the combination of CTFE + string mixins, even in D1, was dramatically more powerful than the proposed macros. It became clear that we didn't have a macro design that was anywhere near powerful enough, and macros were postponed to D3. We don't know how they should work.
By all means make a proposal.

Reply via email to