Discussion Thread: DIP 1036--String Interpolation Tuple Literals--Community Review Round 2

sighoya sighoya at gmail.com
Thu Feb 4 18:55:23 UTC 2021


On Thursday, 4 February 2021 at 16:45:14 UTC, Ola Fosheim Grøstad 
wrote:
> 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.

Agree, but we aren't there yet.

Personally, I would prefer f"$someVar" being rewritten to 
f!"$someVar" such that the whole logic, including custom parsing, 
can be implemented as a pure D function.
It requires however the access to the caller's context in order 
to seek for the missing parameters.
Moreover, further support from the frontend is needed such as 
throwing custom compiler errors and so on…


More information about the Digitalmars-d mailing list