static code generation
    Jacob Carlborg 
    doob at me.com
       
    Thu Dec 13 04:08:14 PST 2012
    
    
  
On 2012-12-09 11:42, js.mdnq wrote:
> How can I create mixes of stringified code and code itself?
>
> http://dlang.org/mixin.html
>
> explains how to create structs using strings. But what if I do not want
> to have to encode the whole struct as a string but only parts of it?
>
>
> mixin template GenStruct(stringname)
> {
>       struct stringname ~ "alpha"
>       {
>           ....
>       }
> }
>
>
> mixin GenStruct!("Helpme");
>
> would be equivalent to do the following
>
> struct Helpmealpha
> {
>      ....
> }
Sounds like someone wants AST-macros. Yes I know, we don't have a proposal.
-- 
/Jacob Carlborg
    
    
More information about the Digitalmars-d-learn
mailing list