Template strings as a template language.

Claude Pache claude.pache at gmail.com
Tue Sep 15 14:39:37 UTC 2015


> Le 15 sept. 2015 à 14:02, Herby Vojčík <herby at mailbox.sk> a écrit :
> 
> 
> 
> Andrea Giammarchi wrote:
>> Yet it doesn't play well with i18n since arguments passed to the IIFE
>> would still come from the current local scope. RegExp would play nicer
> 
> Oh, I meant it other way, my dense communication again produce a misunderstanding, I meant something like "well, one can make regexp as well using eval('/'+aString.replace(/\//g, '\\/' <smb:///'>)+'/') or so, but there still is new Regexp there. So, having string-to-regexp in language, maybe we can as well have string-to-template.

That doesn't make much sense, because regexpes are first-class objects, while template literals are syntax.

The nearest equivalent of the string-to-regexp feature is the string-to-code conversion facility provided by `eval` and `Function`.

I have the impression that people want to use features provided by `eval`, `Function` or `with`, but without pronouncing these taboo words. 
Just use them if you need to: at least you will be clear about what you are really doing.

—Claude

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20150915/d17e5350/attachment-0001.html>


More information about the es-discuss mailing list