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

Reply via email to