ponce

Don nospam at nospam.com
Tue Nov 9 12:22:11 PST 2010


bearophile wrote:
> ponce:
> 
>> Are these things possible at compile-time?
>> 1 - instancing templated struct/class and using them
> 
> Currently classes can't be created at compile time, this fails:
> 
> 
> class Foo {}
> int bar() {
>     Foo f = new Foo;
>     return 0;
> }
> enum int ignore = bar();
> void main() {}
> 
> 
> But this limit may be eventually removed for some well behaved classes (like classes with pure methods that don't contain other things forbidden in CTFE). Don is more expert on this and he is probably able to give you a better answer.
> 
> Bye,
> bearophile
Yes. The rules will be:
* no globals (same as pure).
* no unsafe features (eg, no asm).
* source code must be available.
Everything else should work.


More information about the Digitalmars-d-learn mailing list