compile-time function in a class?

Charlie charlie.fats at gmail.com
Tue Mar 20 11:32:29 PDT 2007


Davidl wrote:
> class test
> {
>     static char[] c(){return "a";}
>     int a;
>     class b
>     {
>         mixin(c());
>     }
> }
> void main()
> {
> 
> }
> 
> don't u think my example should compile?
> 
> i don't violate any thing from evaluating func c from compile-time

I don't think you can instantiate a class at compile time, which is what 
you would need to do.  If all you want to do is mixin variables i 
suggest make a template and mixin it in.




More information about the Digitalmars-d mailing list