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

Re: undefined values in dictionaries

From: Jonas Sicking <jonas@sicking.cc>
Date: Tue, 11 Jun 2013 17:00:59 -0700
Message-ID: <CA+c2ei8FmBzpmc-0wb5zpmJb=A7k1q+CzvD9gRFSswmFXYVzdg@mail.gmail.com>
To: Boris Zbarsky <bzbarsky@mit.edu>
Cc: "public-script-coord@w3.org" <public-script-coord@w3.org>
On Tue, Jun 11, 2013 at 1:43 PM, Boris Zbarsky <bzbarsky@mit.edu> wrote:
> Consider this IDL:
>
>  dictionary Foo {
>    DOMString member = "something";
>  };
>
> and the following object being passed to an argument taking Foo:
>
>   { member: undefined }
>
> Per current WebIDL, this will be treated identically to { member:
> "undefined" }.  Is that what we want, or should it be treated identically to
> { } (which is treated like { member: "something" } in this case) instead?
>
> Or put another way, for dictionaries the current "member is present"
> indicator is what "member in dictionary" returns, not what
> "dictionary.member != undefined" returns.  Both seem valid options depending
> on the API contract...

I think there's agreement here that we should test "dictionary.member
!= undefined" rather than "member in dictionary". This aligns with how
dictionary handling is handled by ES6. The WebIDL spec just hasn't
been updated yet.

/ Jonas
Received on Wednesday, 12 June 2013 00:01:56 UTC

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