- From: Allen Wirfs-Brock <allen@wirfs-brock.com>
- Date: Fri, 15 Nov 2013 10:28:59 -0800
- To: Domenic Denicola <domenic@domenicdenicola.com>
- Cc: Boris Zbarsky <bzbarsky@MIT.EDU>, Jason Orendorff <jason.orendorff@gmail.com>, "public-script-coord@w3.org" <public-script-coord@w3.org>
On Nov 15, 2013, at 9:58 AM, Domenic Denicola wrote: > From: Allen Wirfs-Brock <allen@wirfs-brock.com> > >> As current spec'ed GetIterator("primitiveString") does in fact work with primitive strings. So, any conditional Iterable test also needs to consider a primitive string to be an Iterable. This isn't currently correctly handled in the ES6 spec. It's a new bug that I will fix. > > Sorry, I wasn't quite clear---what do you consider correct, and what do you consider a bug? Is `for`-`of` supposed to work with strings? What about `Array.from`? What about `Promise.all`? Primitive string values behave as objects that inherit from String.prototype which as a @@iterator method. That means that a primitive string value should be usable in all contexts that requires an Iterable. That includes for-of, Array.from, and Promise.all EG, for (let char of "abc\u{1f61c}xyz") ... let chars = Array.from("abc\u{1f61c}xyz"); For Promise.all, it presumably makes just as just as much sense as: Promise.all([1,2,3,4,5]) Allen
Received on Friday, 15 November 2013 18:29:33 UTC