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

Most modern languages already have this feature, JavaScript's the strange one to not have a quick way of putting variables into a string and the first to have to name it though because it was missing it for so long. And by your comment have evidentally chosen a confusing name. This isn't to replace templating engines.

Admittedly you could trivially extend the string prototype to have something more akin to string.format or printf, which was something you couldn't do in other languages for a long time, making it less of a problem.



And still you cant 'lazily' store string vars without evaluating.

In python you can save a string like: template = '%s is %s' and _then_ evaluate its output: print template % ('john', 'tall')




Consider applying for YC's Fall 2026 batch! Applications are open till July 27.

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

Search: