What do you thing about this string interpolation idea

Jonathan Marler johnnymarler at gmail.com
Mon Dec 10 19:08:50 UTC 2018


On Monday, 10 December 2018 at 19:04:21 UTC, Daniel Kozak wrote:
> On Mon, Dec 10, 2018 at 7:40 PM Jonathan Marler via 
> Digitalmars-d < digitalmars-d at puremagic.com> wrote:
>
>>
>>
>> It's not just global scope, it's any outer scope. Examples:
>>
>> class
>> {
>>      mixin(enableInterpolate); // BAD
>>      void foo()
>>      {
>>          interpolate!(...)
>>      }
>> }
>>
>> void foo2()
>> {
>>      mixin(enableInterpolate); // BAD
>>      void inner_foo()
>>      {
>>          interpolate!(...)
>>      }
>> }
>>
>> You can fix this too
>  
> https://gist.github.com/run-dlang/b797fd9e1d4993aeafcdb3d0523ef465

Yes that does mitigate the issue.  It's a clever idea overall 
(someone else had something similar too).  Not as elegant as the 
string literal syntax but it's clever.  Would I use it in my 
code?  Not by default, but if I had a case where string 
interpolation was very beneficial (i.e. code generation) then I 
might use it.


More information about the Digitalmars-d mailing list