DIP 1027---String Interpolation---Community Review Round 1

aliak something at something.com
Thu Dec 12 00:58:09 UTC 2019

On Wednesday, 11 December 2019 at 09:52:21 UTC, Mike Parker wrote:
> This is the feedback thread for the first round of Community 
> Review for DIP 1027, "String Interpolation":
> https://github.com/dlang/DIPs/blob/148001a963f5d6e090bb6beef5caf9854372d0bc/DIPs/DIP1027.md
> All review-related feedback on and discussion of the DIP should 
> occur in this thread. The review period will end at 11:59 PM ET 
> on December 25, or when I make a post declaring it complete.
> At the end of Round 1, if further review is deemed necessary, 
> the DIP will be scheduled for another round of Community 
> Review. Otherwise, it will be queued for the Final Review and 
> Formal Assessment.
> Anyone intending to post feedback in this thread is expected to 
> be familiar with the reviewer guidelines:
> https://github.com/dlang/DIPs/blob/master/docs/guidelines-reviewers.md
> *Please stay on topic!*
> Thanks in advance to all who participate.

1. The DIP fails to mention why this has been chosen as better 
over the other alternatives out there.

2. Why %?
   a) it clashes with format specifiers, sounds like a bad idea.
   b) it's more common in text than other alternatives (e.g. $) 
which means it increases making the user escape text.

3. How does this work with normal strings? And token strings? One 
use-case I've been looking forward to is generative programming 
with token strings and interpolated strings. This doesn't seem to 
help there? If not, why a half solution? If it does, then maybe 
an example?

4. How is this handled?

auto d = 7;
writefln(i"I ate %apples and %{d}bananas totalling %(apples + 
bananas) fruit.");

// bug? silent failure? compiler error? Does it do what the user 

5. I believe you can do everything this DIP does with a better 
syntax -> "$itemPrice%.2f" where $ is the identifier and after 
the % is the formatting. And you don't have to deal with that * 
runtime error

6. What's the rationale behind allowing anything other than %s? 
The type of variable can be inferred?

- Ali

More information about the Digitalmars-d mailing list