opMixin or mixin function templates with convenience operator?

jmh530 john.michael.hall at gmail.com
Thu Dec 12 19:49:34 UTC 2019


On Thursday, 12 December 2019 at 19:08:40 UTC, Paul Backus wrote:
> On Thursday, 12 December 2019 at 18:35:03 UTC, Ola Fosheim 
> Grøstad wrote:
>> It is too noisy for formatting. Also, too hard for newbies to 
>> use, they will misapply it and get weird errors.
>
> I don't think it's any harder to use than the `mixin` keyword, 
> though I'll concede that it's more cryptic to read and harder 
> to search for in the documentation.
>
[snip]

One thing I would be worried about is

instead of
string s = "int y;";
mixin(s);

someone would do
string s = "int y;";
#s;
...
//some point later
y++;

and then try to debug that if something goes wrong.

So would you do this for both mixin expressions and statements?

I feel like limiting it to mixin expressions might actually make 
some of the risk of cryptic stuff happening a little less.


More information about the Digitalmars-d mailing list