Unicode support in new ES6 spec draft

Mark Davis ☕ mark at macchiato.com
Tue Jul 17 18:13:55 PDT 2012


A string reversal is not exactly a high-runner API, and the simple
codepoint reversal will have pretty bad results where grapheme-cluster ≠
single code point.

------------------------------
Mark <https://plus.google.com/114199149796022210033>
*
*
*— Il meglio è l’inimico del bene —*
**



On Tue, Jul 17, 2012 at 3:03 PM, Norbert Lindenberg <
ecmascript at norbertlindenberg.com> wrote:

> We agreed in November not to add String.prototype.reverse because there
> was no compelling use case for it. Is there now?
> https://mail.mozilla.org/pipermail/es-discuss/2011-November/018581.html
>
> Norbert
>
>
> On Jul 17, 2012, at 14:49 , Brendan Eich wrote:
>
> > Allen Wirfs-Brock wrote:
> >> On Jul 16, 2012, at 2:57 PM, Mark Davis ☕ wrote:
> >>
> >>> In order to support backwards iteration (which is sometimes used), we
> should have codePointBefore.
> >>
> >> or we can provide a backwards iterator that knows how to parse
> surrogate pairs:
> >>    for (let c of str.backwards) ...
> >>
> >> Allen
> >
> > Kind of a spin-off, but I think a String.prototype.reverse that avoids
> >
> >  s.split('').reverse().join('')
> >
> > overhead and ES6 Unicode hazard splitting on code unit boundary would be
> swell. It's tiny and matches Array.prototype.reverse but of course without
> observable in-place mutation.
> >
> > It wouldn't relieve all use-cases for reverse iteration, but we have
> iterators and for-of in ES6, we should use 'em.
> >
> > /be
> >>
> >>
> >>>
> >>>
> ------------------------------------------------------------------------
> >>> Mark <https://plus.google.com/114199149796022210033>
> >>> /
> >>> /
> >>> /— Il meglio è l’inimico del bene —/
> >>> //
> >>>
> >>
> >> _______________________________________________
> >> es-discuss mailing list
> >> es-discuss at mozilla.org
> >> https://mail.mozilla.org/listinfo/es-discuss
> > _______________________________________________
> > es-discuss mailing list
> > es-discuss at mozilla.org
> > https://mail.mozilla.org/listinfo/es-discuss
>
> _______________________________________________
> 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/20120717/20811537/attachment-0001.html>


More information about the es-discuss mailing list