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

Steven Schveighoffer schveiguy at gmail.com
Wed Jan 27 16:54:30 UTC 2021


On 1/27/21 10:06 AM, Paul Backus wrote:
> On Wednesday, 27 January 2021 at 14:52:39 UTC, Adam D. Ruppe wrote:
>> On Wednesday, 27 January 2021 at 14:36:10 UTC, Paul Backus wrote:
>>> shifted its focus to metaprogramming applications
>>
>> What metaprogramming applications are you missing?
> 
> The problem isn't that anything's missing, it's that there's too much 
> there in the first place. DIP 1036 is essentially two separate string 
> interpolation proposals (the .idup version and the tuple version) 
> awkwardly stitched together, and the presence of the stitching makes 
> both of them worse than either would be on its own.

I have the exact opposite experience. The previous DIP elicited multiple 
questions on why it was so complex to just get a string out of such a 
literal. Why do I have to add `.text` or `.idup` they would say. This 
includes Andrei, who said he would never use the tuple form, just the 
string form, and if it didn't "just work" it was a failed feature (this 
is my recollection from a phone call, so it's possible I misunderstood).

Without the tuple portion, it's just another run-of-the-mill string 
interpolation feature, which is OK, but just leaves all of D's power on 
the table.

Without the auto-conversion to string, it's a never-been-seen-before 
metaprogramming feature that people just looking to get a string from 
their data will have a hard time using.

With both together, it's a cohesive (not awkward, fully disagree on 
that) setup that does the intuitive thing if you don't know how it 
actually works under the hood, but provide the exact power you need for 
hooking string interpolation when you know about it, and ONLY if you 
want it. I can't imagine how you could make this more metaprogramming 
friendly than it is. I find it to be Great Work as defined by your link. 
In fact, part of the inspiration of adding the idup rewrite was from the 
talk you referred to (in the first review) from Scott Meyers where he 
says that the most obvious thing should be what it does. The most 
obvious thing you get from a string literal is a string.

You and others may disagree, but if this doesn't make it through, I 
don't know what would.

-Steve


More information about the Digitalmars-d mailing list