mixin identifiers concept

Daniel N no at public.email
Mon Feb 7 14:29:47 UTC 2022


On Monday, 7 February 2022 at 10:49:13 UTC, Quirin Schroll wrote:
>
> A much easier solution to this is allowing `mixin()` as an 
> `Identifier` in general:
>
> ```diff
>  Identifier:
>      IdentifierStart
>      IdentifierStart IdentifierChars
> +    MixinExpression
> ```
>
> So, you'd do
>
> ```d
> static foreach(name; ["boo", "foo"])
> {
>     enum string file_name_info = "file_" ~ name ~ "_info";
>     string mixin("file_", name) = readText(name ~ ".txt");
>     string mixin(file_name_info) = readText(name ~ ".meta");
>     auto mixin(name) = mixin(file_name_info).parseInfoFile;
> }
> ```

This looks fantastic!




More information about the Digitalmars-d mailing list