On 02/05/2015 05:12 AM, Andy Earnshaw wrote:
I think you're missing the point Leon is trying to make. He's saying
that, in ES 6 we have a new way to write strings. In some ways, these
more powerful strings may condition some people to use ` as their main
string delimiter. An unsuspecting person may liken this to PHP's
double quotes vs single quotes, thinking that the only difference is
that you can use `${variable}` in strings that are delimited with
backticks, but other than that everything is the same. When they
write this in their code:
```
`use strict`;
```
They may introduce bugs by writing non-strict code that doesn't throw
when it should. Adding it to the spec wouldn't be difficult and it
would avoid any potential confusion or difficult-to-debug issues.
It's definitely easier than educating people, IMO.
'use strict' and "use strict" are magic tokens and should stay that way,
not propagate to other ways of writing literal strings. Literal strings
are different things, which happen to share the same syntax for
backwards-compatibility reasons.
If people switch to backticks for all their literal strings, so much the
better -- then single and double quotes will only be used for
directives, and there will be less confusion. (I don't actually believe
that. At the very least, I don't expect JSON to allow backticks anytime
soon. Nor do I think that using backticks indiscriminately is good
practice.)
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss