Hacker News new | ask | show | jobs
by nerdponx 415 days ago
The big one for me is no string interpolation, as a deliberate design choice.
1 comments

what can string interpolation do that i can't also do by sandwiching a variable between strings: 'string1'$var'string2'?

string interpolation is useful where concatenating strings requires an operator, but i don't see the benefit otherwise.

for more complex examples i can use printf, or someone could write a function that does string interpolation. since there is no need to fork, that should not be that expensive

I mostly agree, but in Bash for example "string1${var}string2" guarantees to be a single argument, which 'string1'$var'string2' doesn‘t (when $var contains whitespace). So it entails certain other language design choices.
in bash yes, so that makes sense. thanks for pointing that out. in elvish $var is guaranteed to remain one string, and so 'string1'$var'string2' is always going to remain one argument too.