The state of string interpolation...one year later

Kagamin spam at here.lot
Sun Mar 17 17:05:46 UTC 2019


On Sunday, 17 March 2019 at 06:01:35 UTC, Jonathan Marler wrote:
> CON 3. Performance.  No matter what we do, any library solution 
> will never be as fast as a language solution.

Must consider the price. Language bloat is not free.

> CON 4. IDE/Editor Support.  A library solution won't be able to 
> have IDE/Editor support for syntax highlighting, auto-complete, 
> etc.  When the editor sees an interpolated string, it will be 
> able to highlight the code inside it just like normal code.

There's IDE support for format string validation for C and C#.

> CON 5. Full solution requires full copy of lexer/parser.  One 
> big problem with a library solution is that it will be hard for 
> a library to delimit interpolated expresions.  For full 
> support, it will need to have a full implementation of the 
> compiler's lexer/parser.

The interpolated string syntax is as complex as the whole D 
language? That sounds bad. AFAIK IDEs don't even support UFCS yet 
even though it should be simple.

> foreach (i; 0 .. 10)
> {
>     mixin(interp(`$( i ~ ")" ) entry $(array[i])`));
> }

That doesn't look nice, does it?


More information about the Digitalmars-d mailing list