Re: IndexedDB: undefined parameters

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