Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> What is so special about string templates that they should be have a different naming scheme?

The fact that you have to distinguish between literal strings and interpolated values



Maybe string interpolation is just a bad idea. Let strings be strings, use string formatting functions if you want to shove data in them.


Or maybe they're a very nice convenience, which is why a lot of modern languages are implementing them.

String formatting functions use special strings themselves.


They do, but very well-defined ones, little placeholders that just concern themselves with formatting. You include the whole variable name and that makes it brittle, now random bits of string data have to be kept in sync with actual code, and makes it a lot more unwieldy to format in a way that isn't the default representation.


Maybe take a look at lit-html, postgresjs and some others to get a sense of what's possible with good string templating.


Those do look quite nice, fairly far away from the nightmares I've dealt with before. They also seem to avoid the problem of just about summoning a whole separate archaic syntax just for jamming variables into a string.




Consider applying for YC's Winter 2026 batch! Applications are open till Nov 10

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: