Can we make mixin applications first class at the type level?

Nick Treleaven nick at geany.org
Thu Mar 21 10:35:23 UTC 2019


On Thursday, 21 March 2019 at 09:59:48 UTC, sighoya wrote:
> Of course we could simply write the complete struct S as string 
> mixin, but most existing code isn't saved in this format 
> because string mixins suck (no syntax highlighting).

In my editor (Geany/Scintilla) q{} contents are highlighted like 
code:
https://dlang.org/spec/lex.html#token_strings

> It would be that easy if we weren't forced to apply mixins with 
> the mixin keyword, why the hell we need to if we annotate our 
> template with mixin.

For reasoning about code and hygiene, the use site has to 
indicate to the programmer that code is being inserted into the 
current scope, rather than just calling a function.

The syntax could be tweaked so `$ident!targs(args)` expands to 
`mixin(ident!targs(args))`.


More information about the Digitalmars-d mailing list