The state of string interpolation

Jonathan M Davis newsgroup.d at jmdavisprog.com
Sat Dec 8 03:11:10 UTC 2018


On Friday, December 7, 2018 7:29:10 PM MST Steven Schveighoffer via 
Digitalmars-d wrote:
> On 12/7/18 9:04 PM, Jonathan M Davis wrote:
> > On Friday, December 7, 2018 5:58:43 PM MST o via Digitalmars-d wrote:
> >> On Friday, 7 December 2018 at 23:56:48 UTC, Adam D. Ruppe wrote:
> >>> On Friday, 7 December 2018 at 23:46:45 UTC, o wrote:
> >>>> Also, see Andrei's comment:
> >>>> https://github.com/dlang/dmd/pull/7988#issuecomment-375760720
> >>>
> >>> He seems to also have the misunderstanding that was common
> >>> earlier in this thread that tuple == std.typecons.
> >>
> >> This is probably going to confuse more people, so we should refer
> >> to them as "sequences" in the DIP. Also, I am calling it "String
> >> Sequence Literals" instead of "String Interpolation" because it
> >> is more broad - more than just interpolation can be done with
> >> this.
> >
> > Personally, I'd just use the term AliasSeq, because that's what the
> > associated template for them in Phobos is called. Just about anything
> > else is going to be confusing. It's really unfortunate that Walter
> > originally decided to call them tuples given that they aren't quite
> > tuples, but there really isn't a good term for them ultimately. As it
> > is, AliasSeq was just the best of a bad set of choices, but at least
> > it's clear what you mean what you use the term, whereas just about
> > anything else breeds confusion.
> But it's not an AliasSeq. It's simply a list of items.
>
> for example, I want this to work:
>
> writeln(i"a + b = ${a+b}");
>
> And this compiles:
>
> writeln("a + b = ", a + b);
>
> But this does not:
>
> writeln(AliasSeq!("a + b = ", a + b));

*sigh* So, we'd be creating yet another similar concept with this? That
seems really questionable. I can see why you'd want something like i"a + b =
${a+b}" to work, but we already have enough confusion around "tuples" as it
is without trying to add a third kind.

- Jonathan M Davis





More information about the Digitalmars-d mailing list