What do you thing about this string interpolation idea

Steven Schveighoffer schveiguy at gmail.com
Mon Dec 10 19:19:35 UTC 2018


On 12/10/18 2:16 PM, Neia Neutuladh wrote:
> On Mon, 10 Dec 2018 19:35:16 +0100, Daniel Kozak wrote:
>> I do not see any problem with add one line in every function.
> 
> One line in every scope, rather:
> 
>      void foo()
>      {
>        mixin(interpSupport);
>        {
>          auto i = 10;
>          // doesn't work
>          writeln(interp!"i is $i");
>        }
>      }
> 

This is less of a problem, because it breaks and tells you why it 
breaks. Whereas the other silent hijacking of which symbol you're 
talking about could be more confusing.

People would likely just hoist those variables up to the outer scope 
rather than moving the mixin (I know I would).

Still one of the warts, though.

-Steve


More information about the Digitalmars-d mailing list