DIP 1027--String Interpolation--Final Review Discussion Thread
Adam D. Ruppe
destructionator at gmail.com
Tue Feb 4 23:03:45 UTC 2020
On Tuesday, 4 February 2020 at 18:41:20 UTC, jmh530 wrote:
> Under the addendum proposal, is it also the case that functions
> that take strings or printf can instead take the interpolated
> string?
That would depend on the druntime implementation. I think my
preference would be it implicitly casts to string and const char*
if and only if all format specifiers are given by the user.
I just wrote up a revised DIP based on Walter's to detail my
current thoughts:
https://gist.github.com/adamdruppe/a58f097d974b364ae1cbc8c050dd9a3f
and wow that took like 3 hours. I have other things to do now so
I haven't proofread it yet, but it basically explains what I'm
feeling is ideal based on this thread with a couple small new
ideas (like the `idup` overload that replaces my old `toString`
proposal)
But the executive summary is
1) Steven's proposal from earlier, but with `Format.init` changed
to `Format(null)`. Same result now but easier to add another
argument in the future if we decide to extend this.
2) A sample library implementation you can play with. You'll have
to write out the lowering by hand though since I didn't do a
mixin translator this time.
3) A couple use cases and benefit examples written up. I also
want to mention i18n but I ran out of time like two hours ago so
bleh.
4) Most Walter's limitations are eliminated and I cleaned up some
of the language (like that MixinExpression) one too.
I got more into the implementation weeds than I probably should
have but with that you can see more clearly in exact detail what
behavior I am envisioning.
More information about the Digitalmars-d
mailing list