Re: IndexedDB: undefined parameters

On 10/10/12 10:15 PM, Brendan Eich 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!

Well, the thing is, dictionaries can have default values.  So given this 
IDL:

   dictionary Dict {
     long a = 2;
   };
   void foo(Dict arg);

and then a call like so:

   foo({ a: undefined });

should the callee see the value of "a" as 2 or 0?

Note that this is not quite the same question as this one:

Given this IDL:

   dictionary Dict {
     long a;
   };
   void foo(Dict arg);

and then a call like so:

   foo({ a: undefined });

should the callee see the value of "a" as 0 or "nor present"?

Right now WebIDL says "0" for both of these cases.  I'm fine with that, 
generally; just wanted to make sure that was what we really wanted.

-Boris

Received on Thursday, 11 October 2012 02:26:40 UTC