String Interpolation

IGotD- nise at nise.com
Fri Oct 27 09:30:46 UTC 2023


On Thursday, 26 October 2023 at 10:40:34 UTC, Imperatorn wrote:
>
> Any DIP that doesn't provide a way to get a string from an 
> interpolated string is almost useless to the users. And the 
> language exists for the users. It doesn't exists for library 
> writers.

I've not been following the string interpolation debate because 
I'm not a big user of string interpolation but this made me wake 
up. Are you seriously proposing a design that cannot convert a 
string interpolated string into a regular string?

> There's a clear difference between languages that exist for the 
> users and languages that just exist for the language creators 
> and library writers. The latter category fades into oblivion 
> very quickly.

This is a trap that many compiler engineers fall into, not only D 
but I have also observed the same among other languages. These 
are usually "hobbyist" languages and not languages that big 
companies are involved with.

The compiler engineers at some point forget that computer 
languages are made to make it easier for humans and not to make 
it easier for the computer or the language developer. I've seen 
several motivations like "that will make things so difficult" or 
"it will mess up my beautiful compiler code".

Examples of this is, not supporting early returns because program 
flow analysis of early returns is "difficult".
Another example is D with not supporting this() constructor for 
structs. A workaround in order to add it into the syntax is 
obviously not allowed.

D started out really well by departing from the horrible C++ 
syntax in order to make more readable, these days D seem to have 
abandon this heritage.


More information about the Digitalmars-d mailing list