Re: How to correctly spec sequences requiring an iterable

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