Discussion Thread: DIP 1036--String Interpolation Tuple Literals--Community Review Round 2
Ola Fosheim Grøstad
ola.fosheim.grostad at gmail.com
Thu Feb 4 16:45:14 UTC 2021
On Thursday, 4 February 2021 at 16:27:32 UTC, Adam D. Ruppe wrote:
> I'm very skeptical most this stuff will actually matter in
> practice since most cases will be used in function calls.
I think it would be better to improve on templates/CTFE so that
interpolated strings can be implemented as pure meta programming.
Basically some way to say that a prefix for a string matches up
with a certain type of template (by name or other means).
Then some way to emit mixins into the calling context, maybe some
way to query the calling context.
So if you write:
writeln(f`Four is {1+3}!`)
The lookup will hit some templated construct f__interpolate__!….
writeln(f__interpolate__!`Four is {1+3}!`())
Which has special capabilities that allows it to emit:
writeln(mixin(`tuple("Four is ", (1+3).to!string(),
"!").expand`));
D does not need more builtins, improve on pure meta programming
instead seems more productive.
More information about the Digitalmars-d
mailing list