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

Re: IndexedDB: undefined parameters

From: Jonas Sicking <jonas@sicking.cc>
Date: Wed, 10 Oct 2012 22:57:02 -0700
Message-ID: <CA+c2ei8+htjSZn13OrQeGcS8yCCJdYHqerdDdgd3WM=7ek7MFg@mail.gmail.com>
To: Brendan Eich <brendan@mozilla.org>
Cc: Boris Zbarsky <bzbarsky@mit.edu>, Robert Ginda <rginda@chromium.org>, Alec Flett <alecflett@chromium.org>, public-webapps@w3.org, "public-script-coord@w3.org" <public-script-coord@w3.org>
On Wed, Oct 10, 2012 at 7:15 PM, Brendan Eich <brendan@mozilla.org> wrote:
> Boris Zbarsky wrote:
>>
>> Should "undefined", when provided for a dictionary entry, also be treated
>> as "not present"?  That is, should passing a dictionary like so:
>>
>>   { a: undefined }
>>
>> be equivalent to passing a dictionary that does not contain "a" at all?
>
> ES6 says no. That's a bridge too far. Parameter lists are not objects!

I thought the idea was that for something like:

function f({ a = 42 }) {
  console.log(a);
}
obj = {};
f({ a: obj.prop });

that that would log 42.

What is the reason for making this different from:

function f(a = 42) {
  console.log(a);
}
obj = {};
f(obj.prop);

It seems to me that the same "it'll do the right thing in all
practical contexts" argument applied equally to both cases?

I might very well be missing something though?

/ Jonas
Received on Thursday, 11 October 2012 05:57:59 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 8 May 2013 19:30:07 UTC