Interpolated strings

Walter Bright via Digitalmars-d digitalmars-d at puremagic.com
Tue Apr 18 01:50:07 PDT 2017


On 4/15/2017 4:51 PM, cym13 wrote:
> Removing imports is a good point, the first concrete one to be mentionned. I'm
> not sure it matters that much though as I think those imports are generic enough
> that I believe they would be imported anyway, but it's a real point.

It may not be necessary to have any dependencies on any import.

     $"{a} times 3 is {a*3}"

could be rewritten by the parser to:

     "%s times 3 is %s", a, a * 3

and that is that. (I.e. just an AST rewrite.) It would be quite a bit simpler 
than Jonas' proposed implementation.


More information about the Digitalmars-d mailing list