4 ms·
Take a look at ECMAScript quasi-literals -- they are solving the same problem that you're trying to address: http://wiki.ecmascript.org/doku.php?id=harmony:qua
by chubot 15y ago
Take a look at ECMAScript quasi-literals -- they are solving the same problem that you're trying to address:
http://wiki.ecmascript.org/doku.php?id=harmony:quasis http://wiki.ecmascript.org/doku.php?id=harmony:quasis
http://www.2ality.com/2011/09/quasi-literals.html http://www.2ality.com/2011/09/quasi-literals.html
I think they are going further because they can do auto-escaping. From what I see of your language, you still have to do html:"$var". What happens if you mis-type the prefix? Do you get incorrect escaping and a security hole? Some web devs won't even know what language they're writing in.
FWIW I don't think it's worth building an entire language around this concept. It's a feature, not a language. I think using Python plus a template language with good escaping basically solves the problem.
Also, it would be weird if html: and sql: are built in to the language -- that should be a layer on top of a smaller language (just like quasi-literals).
Also, a server-side language with special escaping support doesn't seem compelling, because these days you would want special escaping support on the client too. I'm not sure of the status of quasi-literals, but if they make it into V8 then Node.JS will have this feature on the server.