Discussion Thread: DIP 1036--Formatted String Tuple Literals--Community Review Round 1

Aliak something at something.com
Sat Sep 12 07:49:49 UTC 2020

On Friday, 11 September 2020 at 20:46:05 UTC, Paul Backus wrote:
> On Friday, 11 September 2020 at 19:59:35 UTC, Adam D. Ruppe 
> wrote:
>> On Friday, 11 September 2020 at 19:31:33 UTC, Paul Backus 
>> wrote:
>>> The solution is to use the type system.
>> This is exactly what the DIP does!
>> Something serious must have gotten lost between my brain and 
>> the text.
> I guess you didn't have time to check out the video. What I 
> mean is, the solution is to change the signature of 
> "createWindow":
>     alias Width = Typedef!(int, int.init, "Width");
>     alias Height = Typedef!(int, int.init, "Height");
>     void createWindow(string title, Width width, Height height);

Requiring to retype int semantically for every function that has 
a string followed by an int to avoid “non-obvious” affects of a 
language feature seems seems a bit overkill.

Pretty sure there was something in Scott meyers talks about APIs 
that work how you’d expect them to as well.

> This solves the issue of accidentally passing the wrong thing 
> with i"Window $id", and also prevents non-interpolation-related 
> accidental usage, like mixing up the width and height.
>> This DIP builds on D's unique strengths, enhancing existing 
>> opportunities. None of the others come close, they're just 
>> syntax sugar.
> I agree with this 100%, except I think it's a point against DIP 
> 1036 and in favor of the other proposals. :)
> We already have ways to put stuff in the middle of strings. The 
> reason we want string interpolation is to make the syntax for 
> it less ugly. So, it *should* be "just syntax sugar." Anything 
> beyond that is bloat.

More information about the Digitalmars-d mailing list