W3C home > Mailing lists > Public > public-script-coord@w3.org > October to December 2013

Re: How to correctly spec sequences requiring an iterable

From: Brendan Eich <brendan@secure.meer.net>
Date: Fri, 15 Nov 2013 11:01:18 -0800
Message-ID: <52866F7E.5090906@secure.meer.net>
To: Allen Wirfs-Brock <allen@wirfs-brock.com>
CC: Brendan Eich <brendan@mozilla.org>, Domenic Denicola <domenic@domenicdenicola.com>, Boris Zbarsky <bzbarsky@MIT.EDU>, Jason Orendorff <jason.orendorff@gmail.com>, "public-script-coord@w3.org" <public-script-coord@w3.org>
Allen Wirfs-Brock wrote:
> On Nov 15, 2013, at 10:12 AM, Brendan Eich wrote:
>
>> >  Jason should weigh in, but I favor for-of working on strings. They are array-like albeit frozen.
>
> for-of requires an Iterable, not an array-like

Yes, and my point is array-like is iterable. This is an argument from 
particular to general, otherwise we can't make progress. : -/

>   and frozen or not really isn't relevant.

Agreed, wherefore my "albeit ...".

> But, for consistency, strings really need to work like the equivalent String wrapper for purposed of property access, so they need to work that way in for-of and all other Iterable contexts.

Wrapper, schmapper.

It all works out, we seem to agree, but your reasoning seems backwards. 
We don't argue about for-of on a string by starting with String wrapper, 
or (uselessly) starting with iterable (since that begs the question). We 
do better to start arguing from utility (use-cases), and of course from 
some algebraic category or approximate notion of same, namely array-like.

If all array-likes are iterable, and string (primitive or wrapper, 
doesn't matter) are array-like, then string must be iterable. QED :-P.

>> >  On null or undefined, I see no need for the null disjunct. Precedent outside of null == undefined is lacking - particularly for a protocol (interface) test of this kind.
>
> In general, null is useful, if you want to be sure you don't trigger a default parameter substitution.  Don't know whether that makes much of a difference in this case

It's not a big deal, but a use-case would help more than a what-if. 
Also, moar precedent (even if new in ES6). Got any?

/be
Received on Friday, 15 November 2013 19:01:46 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 17:14:19 UTC