Re: How to correctly spec sequences requiring an iterable

On Nov 15, 2013, at 11:01 AM, Brendan Eich wrote:

> Allen Wirfs-Brock wrote:
> 
>>> >  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?
> 

The Map and Set constructors are currently specified that way.  If you want to create an empty instance that uses the "is" comparator you can say either:

     let empty = new Map(undefined, "is");
or
     let empty = new Map(null, "is");

In addition to being shorter, I find the latter to be slightly more pleasant and consistent with the general meaning of null as in this case I an explicitly passing no object, rather than asking for a default value.

Allen

Received on Friday, 15 November 2013 19:51:28 UTC