CTFE vs. traditional metaprogramming

Jarrett Billingsley jarrett.billingsley at gmail.com
Fri Oct 9 14:02:13 PDT 2009


On Fri, Oct 9, 2009 at 4:57 PM, Sean Kelly <sean at invisibleduck.org> wrote:
> == Quote from Andrei Alexandrescu (SeeWebsiteForEmail at erdani.org)'s article
>> Thanks!
>> I plan to add more text at the end of the chapter that discusses the
>> opportunities of CTFE. Walter revealed to me that CTFE, particularly now
>> after it's been improved by leaps and bounds by Don and by Walter
>> himself, could obviate a lot of the traditional metaprogramming
>> techniques developed for C++.
>> One question that bugs me is, where do you draw the line? Say there's a
>> metaprogramming problem at hand. How to decide on solving it with CTFE
>> vs. solving it with templates? It would be great to have a simple
>> guideline that puts in contrast the pluses and minuses of the two
>> approaches.
>
> CTFE is great for working with values while template metaprogramming is
> great for working with types.  String mixins make CTFE good at working
> with types as well, but I wouldn't consider them a novice-level feature.

Throw templates in there. Boom! Goodbye, CTFE.

(.stringof and templates do not get along.)



More information about the Digitalmars-d mailing list