CTFE vs. traditional metaprogramming

BCS none at anon.com
Mon Oct 12 09:51:48 PDT 2009


Hello language_fan,

> Sat, 10 Oct 2009 10:26:11 +0200, Don thusly wrote:
> 
>> CTFE doesn't mean "string mixins using CTFE". It just means CTFE.
>> (BTW you can do string mixins with templates only, no CTFE, if you
>> are completely insane).
>> 
> CTFE without mixins is rather limited form of metaprogramming. You can
> basically only initialize some static non-code data, and not much
> more. String mixins with templates was the only way to go before CTFE
> became possible -- those were the times!
> 

What does yacc do? Build a switch statement via cut-n-paste, define a few 
constants, define a few types via cut-n-paste, and initialize some static 
data.

Oh and there's no such thing as non-code data, if you are crazy enough:

const byte[] it = buildPositionIndependentCodeAsString(Data);
int i = (cast(int function(int))it.ptr)(42);





More information about the Digitalmars-d mailing list