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

Re: How to correctly spec sequences requiring an iterable

From: Allen Wirfs-Brock <allen@wirfs-brock.com>
Date: Fri, 15 Nov 2013 11:50:51 -0800
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>
Message-Id: <1364C3D5-6B67-446A-9E8E-65C8054F3865@wirfs-brock.com>
To: Brendan Eich <brendan@secure.meer.net>

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

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