Discussion Thread: DIP 1036--String Interpolation Tuple Literals--Community Review Round 2
Adam D. Ruppe
destructionator at gmail.com
Mon Feb 1 16:10:46 UTC 2021
On Monday, 1 February 2021 at 16:00:54 UTC, Dukc wrote:
> Perhaps mixins can be special case to invoke `idup` if any of
> their arguments are instanced from `interp`.
Yeah, the grammar could always just special case overload
mixin(Interpolated).
Or .stringof could be redefined so like interp!"foo".stringof ==
"foo" or whatever.
.... or just ban it. Make mixin(i"...") a compile error so the
user can do their own thing.
Frankly I think it is madness that mixin uses stringof in the
first place since it is so poorly defined. The spec specifically
says:
https://dlang.org/spec/property.html#stringof
Implementation Defined: The string representation for a type or
expression can vary.
Best Practices: Do not use .stringof for code generation. Instead
use the identifier trait, or one of the Phobos helper functions
such as std.traits.fullyQualifiedName.
So why the heck is that built into the language?!?
More information about the Digitalmars-d
mailing list