opMixin or mixin function templates with convenience operator?

jmh530 john.michael.hall at gmail.com
Thu Dec 12 17:26:19 UTC 2019


On Thursday, 12 December 2019 at 10:33:21 UTC, aliak wrote:
> [snip]
>
> You get the hygiene with # as I believe it's not used anywhere? 
> And this enables string interpolation libraries that have the 
> syntax that any or all of the dips that are being propose have.
>
> - ali

The idea for the convenience operator is discussed on the DIP 
1027 thread [1] by Paul Backus (though he uses @ and I'm a bit 
more sympathetic to your #). The way he describes it is just a 
simple re-write of
writeln(@interp!"The number ${num} doubled is ${num * 2}!"));
to
writeln(mixin(interp!"The number ${num} doubled is ${num * 2}!"));

I find it an interesting idea, but wonder what the consequences 
of this are more generally.


[1] 
https://forum.dlang.org/thread/abhpqwxqgiyzgqxmjaky@forum.dlang.org?page=7#post-tlyhhcpomntiwoqxsvjj:40forum.dlang.org


More information about the Digitalmars-d mailing list