Unicode support in new ES6 spec draft

Brendan Eich brendan at mozilla.org
Tue Jul 17 14:49:39 PDT 2012


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


More information about the es-discuss mailing list