DIP 1027---String Interpolation---Community Review Round 1
ag0aep6g
anonymous at example.com
Tue Dec 17 17:19:39 UTC 2019
On 17.12.19 18:12, Steven Schveighoffer wrote:
> I tried this, still prints 5 apples and 6 bananas:
>
> int apples = 5;
> int bananas = 6;
> auto as = AliasSeq!("%s apples and %s bananas", apples, bananas);
> // essentially what an interpolated string will evaluate to
> writefln(as);
> ++apples;
> ++bananas;
> writefln(as);
>
> It seems that AliasSeq doesn't store the alias (ironically), but the
> value of the expression at the time.
>
> Is there a way that this could work? I mean, aside from storing lambdas
> for everything?
alias as = AliasSeq!("%s apples and %s bananas", apples, bananas);
More information about the Digitalmars-d
mailing list