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

Jab jab_293 at gmall.com
Sun Dec 15 20:13:44 UTC 2019


On Sunday, 15 December 2019 at 18:25:40 UTC, Guillaume Piolat 
wrote:
> On Sunday, 15 December 2019 at 17:26:57 UTC, Jab wrote:
>> On Sunday, 15 December 2019 at 15:36:09 UTC, Guillaume Piolat
>>
>> There's no reason it can't be implicitly converted to a string.
>
>
> Okay. Let's say this would compile:
>
>     int stuff = 4;
>     string s = i"my interpolated %stuff string";
>
>
> Where should the result of i"my interpolated %stuff string" be 
> allocated?
> If you answer "with the GC", then this feature requires the 
> runtime...

"Implicitly converted" meaning it exists as something else and 
can be converted to it. If you don't want the GC then don't use a 
string.

      @nogc:

      int stuff = 4;
      auto t = i"my interpolated %stuff string";
      string s = mallocString(t); // no different than having to 
call malloc() + snprintf()



More information about the Digitalmars-d mailing list