d at domenic.me (2015-02-17T18:03:24.696Z)
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.
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. On Thu, Feb 5, 2015 at 10:56 AM, Mathias Bynens <mathias at qiwi.be> wrote: > > > On 5 Feb 2015, at 11:04, Leon Arnott <leonarnott at gmail.com> wrote: > > > > Well, that isn't quite the full story - if it were just a case of > pragmas having to use something, anything, that could pass ES3 engines, > then there wouldn't necessarily be two otherwise-redundant forms of the > syntax - `"use strict"` and `'use strict'`. The reason those exist is to > save the author remembering which string delimiter to use - it mirrors the > string literal syntax exactly. > > If that were the case, then e.g. > `'\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74'` would trigger strict mode. (It > doesn’t, and that’s a good thing.) > _______________________________________________ > es-discuss mailing list > es-discuss at mozilla.org > https://mail.mozilla.org/listinfo/es-discuss > -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20150205/da0b6866/attachment.html>