string mixin and alias

rikki cattermole via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Jul 28 23:39:44 PDT 2016


On 29/07/2016 6:38 PM, Andre Pany wrote:
> Hi,
>
> is there a way to alias a string mixin?
> Neither foo nor foo2 compiles.
>
> import std.meta : Alias;
> alias foo = (s) => Alias!(mixin(generateCode(s)));
> alias foo2(string s) = Alias!(mixin(generateCode(s)));
>
> string generateCode(string s){return "";}
>
> void main()
> {
>   enum s = "a = 2 + 3; b = 4 + a;";
>   foo(s);
>   foo2(s);
> }
>
> Kind regards
> André

Well those string mixins are not evaluating out to a symbol. So that 
could be a rather big problem for the Alias template.


More information about the Digitalmars-d-learn mailing list