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

Re: Promises "if not omitted" language

From: Rick Waldron <waldron.rick@gmail.com>
Date: Mon, 22 Jul 2013 14:39:00 -0400
Message-ID: <CAHfnhfqgec1a+Ry+QqpS08cxjb=01_W0QfjgPDhneEQKbJ8oAw@mail.gmail.com>
To: Boris Zbarsky <bzbarsky@mit.edu>
Cc: "public-script-coord@w3.org" <public-script-coord@w3.org>
On Monday, July 22, 2013, Boris Zbarsky wrote:

> On 7/22/13 12:14 PM, Domenic Denicola wrote:
>
>> FWIW I think there are two coherent choices here: `undefined`/function
>> only, or anything allowed, with non-functions triggering the default
>> behavior.
>>
>
> There's a third choice: undefined and both null trigger default behavior,
> functions get called, anything else is disallowed.


Not the same, but possibly very similar as at as far as developer
comprehension, re: default params: undefined triggers default param, but
null does not.

function f(a = "hi!") { return a; }

f();
// "hi!"
f(undefined);
// "hi!"
f(null);
// null


Rick



>
> Or is that what you mean by the "antipattern that DOM specs in particular
> have perpetuated"?
>
> -Boris
>
>
Received on Monday, 22 July 2013 18:39:27 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 21:37:50 UTC