fair enough, that was my point about > except for RAM and CPU, life is going to be easier for devs
so my counter-question would be: is there any way to do that in core so that we can “💩💩💩”.split() it so that we can have an ArrayLike that with [1] gives back the single “💩” and not the whole thing ? Or does Mathyas have already a RegExp able to split like that with reasonable perfomance ? P.S. I am in Chrome and Safari and I had no idea until I've seen that on twitter what kind of “💩” we were talking about :D On Fri, Oct 18, 2013 at 10:34 AM, Allen Wirfs-Brock <al...@wirfs-brock.com>wrote: > > On Oct 18, 2013, at 10:18 AM, Andrea Giammarchi wrote: > > if this is true then .at(symbolIndex) should be a no-brain ? > > ``` > var virtualLength = 0; > for (var x of "💩") { > virtualLength++; > } > > // equivalent of > for(var i = 0; i < virtualLength; i++) { > "💩".at(i); > } > > ``` > > Am I missing something ? > > > Yes, we don't want to introduce code point based direct indexing, which > alway requires scanning from the front of the string. We already made that > decision in the context of charPointAt which only use code unit indices. > > Allen > > > > > > > > > On Fri, Oct 18, 2013 at 10:03 AM, Allen Wirfs-Brock <al...@wirfs-brock.com > > wrote: > >> >> On Oct 18, 2013, at 9:05 AM, Anne van Kesteren wrote: >> >> > On Fri, Oct 18, 2013 at 4:58 PM, Mathias Bynens <math...@qiwi.be> >> wrote: >> >> On 18 Oct 2013, at 10:48, Anne van Kesteren <ann...@annevk.nl> wrote: >> >>> When you phrase it like that, I see another problem with >> >>> codePointAt(). You can't just replace existing usage of charCodeAt() >> >>> with codePointAt() as that would fail for input with paired >> >>> surrogates. E.g. a simple loop over a string that prints code points >> >>> would print both the code point and the trail surrogate code point for >> >>> a surrogate pair. >> >> >> >> I disagree. In those situations you should just iterate over the >> string using `for…of`. >> > >> > That seems to iterate over code units as far as I can tell. >> > >> > for (var x of "💩") >> > print(x.charCodeAt(0)) >> > >> > invokes print() twice in Gecko. >> > >> >> No that's not correct, the @@iterator method of String.prototype is >> supposed to returns an interator the iterates code points and returns >> single codepoint strings. >> >> The spec. for this will be in the next draft that I release. >> >> Allen >> _______________________________________________ >> es-discuss mailing list >> es-discuss@mozilla.org >> https://mail.mozilla.org/listinfo/es-discuss >> > > >
_______________________________________________ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss