CTFE vs. traditional metaprogramming

language_fan foo at bar.com.invalid
Sat Oct 10 13:48:15 PDT 2009


Sat, 10 Oct 2009 01:21:32 -0400, bearophile thusly wrote:

> Jeremie Pelletier:
>  
>> I would rather have TypeInfo usable at compile time than a "type" type.
> 
> That's useful, but it's not enough. So you may want both. Sometimes all
> you want to pass to a function is a type, to replace some of the use
> cases of templates. Time ago I have shown some usage examples here. To
> me it seems that where they can be used they give a little more natural
> means to do some things (but templates can't be fully replaced).

Actually the TypeInfo structure can have more or less the same semantics 
as a distinct 'type' type. Your idea is good, but you need to beef up the 
specs before the proposal gets any useful. What you need is some kind of 
facility to query information about the type, and possible other 
information to generate new types.



More information about the Digitalmars-d mailing list