On 24 Aug 2013, at 11:02, Mathias Bynens <[email protected]> wrote:
> Wouldn’t this be confusing, though?
>
> global['\u{2F800}'] = 42; // would work (compatible with ES5 behavior)
> global['\uD87E\uDC00'] = 42; // would work, too, since `'\uD87E\uDC00' ==
> '\u{2F800}'` (compatible with ES5 behavior)
> var \uD87E\uDC00 = 42; // would fail (compatible with ES5 behavior)
> var \u{2F800} = 42; // would work (as per your comment; incompatible with
> ES5 behavior)
> var 丽 = 42; // would work (as per your comment; incompatible with ES5
> behavior)
>
> Using astral symbols in identifiers would be backwards incompatible, even if
> the raw (unescaped) symbol is used. There’d be no way to use such an
> identifier in an ES5 environment. Is this a problem?
To clarify: consider what the Identifier Identification strawman[1] or any
scripts that emulate similar behavior should do if Allen’s suggestion would be
implemented:
String.isIdentifierStart('\uD87E\uDC00'); // should be `false`
String.isIdentifierStart('\u{2F800}'); // should be `true`
// this is impossible, since `'\uD87E\uDC00' === '\u{2F800}'` and there is
no way to distinguish these strings
[1] http://wiki.ecmascript.org/doku.php?id=strawman:identifier_identification
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss