What about an identifier that is an mixin

André Puel via Digitalmars-d digitalmars-d at puremagic.com
Fri Jan 13 13:15:32 PST 2017


One thing that I miss sometimes when doing meta programming is 
being able to hide that a function should be called with mixin.

For example (pardon my lack of creativity):

     // Instead of
     string declare_a() {
         return "int a;"
     }

     int func() {
         mixin(declare_a);
         return a;
     }

     // Could we have?
     mixin declare_a() {
         return "int a;";
     }

     int func() {
         declare_a;
         return a;
     }

I think this could be useful when one is creating Idiom and 
Patterns, you could hide implementations details.


More information about the Digitalmars-d mailing list