Mathias Bynens
unread,Sep 24, 2013, 6:17:22 AM9/24/13Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Sign in to report message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to v8-u...@googlegroups.com, dsl...@chromium.org, Norbert Lindenberg, Allen Wirfs-Brock
# TC39 acceptance
Norbert Lindenberg fleshed out a proposal that defined these methods back in May 2012: <
http://norbertlindenberg.com/2012/05/ecmascript-supplementary-characters/#String>. Since then, the document received multiple rounds of feedback through the es-discuss list and during TC39 meetings, and and has been revised multiple times.
Finally, Allen-Wirfs Brock made the algorithms for these methods more consistent with `String.fromCharCode` and `String.prototype.charCodeAt` and added them to the ECMAScript 6 draft specification (July 8, 2012). Since then, no changes were made to these definitions, indicating their behavior is fairly stable.
One spec bug remains to be fixed: <
https://bugs.ecmascript.org/show_bug.cgi?id=1153>. However, it’s pretty clear the intent is to return `undefined` and not `NaN` (the algorithms in both the proposal and the ES6 draft agree on it).
There’s also a discussion on whether JavaScript should allow lone surrogates in strings or not:
http://esdiscuss.org/topic/code-points-vs-unicode-scalar-values But historically, this is what JavaScript has always done, and changing this behavior might break backwards compatibility or introduce new forms of hazardous silent data corruption.
# Interest from other browser vendors
Firefox/SpiderMonkey has a patch to implement these features:
https://bugzilla.mozilla.org/show_bug.cgi?id=918879 Note: the patch doesn’t hide the feature behind an optional flag.
# Testing
This patch implements the feature under the `--harmony` flag: <
https://codereview.appspot.com/13816046/>. It also adds conformance tests for these methods, taken from <
https://github.com/mathiasbynens/String.prototype.codePointAt/blob/master/tests/tests.js> and <
https://github.com/mathiasbynens/String.fromCodePoint/blob/master/tests/tests.js>. All conformance tests pass.