DIP idea: q{}-inspired block mixins

Paul Backus snarwin at gmail.com
Thu Nov 5 06:04:47 UTC 2020


On Thursday, 5 November 2020 at 04:07:06 UTC, Q. Schroll wrote:
> Here is the DIP PR: https://github.com/dlang/DIPs/pull/194 and 
> the DIP document: 
> https://github.com/Bolpat/DIPs/blob/TokenMixins/DIPs/DIP-1NN2-QFS.md
>
> Please let me know of any suggestions that come to your mind in 
> this thread or the PR discussion.

This seems like an extremely narrow and special-purpose feature 
for something that could just as easily be addressed by a more 
general feature, like string interpolation or quasiquotation.

It also shares the same basic weakness as format strings, which 
is that every time you see (for example) an `op` in the mixin 
body, you have to look somewhere else in the code to see what 
it's going to be replaced with. And unlike a `%s` format 
specifier, there's no easy way to distinguish a replacement token 
in the mixin body from a normal identifier.


More information about the Digitalmars-d mailing list