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

Re: [WebIDL] Dictionaries and undefined

From: Brendan Eich <brendan@mozilla.org>
Date: Tue, 11 Oct 2011 13:42:53 -0400
Cc: "Mark S. Miller" <erights@google.com>, Dominic Cooney <dominicc@google.com>, Jonas Sicking <jonas@sicking.cc>, public-script-coord@w3.org
Message-Id: <5FD1F17C-5580-4915-A807-520564740DA1@mozilla.org>
To: Erik Arvidsson <arv@chromium.org>
On Oct 11, 2011, at 1:25 PM, Erik Arvidsson wrote:

> Also, worth considering is optional arguments in the current ES6
> draft. In ES6 the value undefined is not treated as absent.
> 
> function f(x = 42) {
>  return x;
> }
> 
> print(f());  // "42"
> print(f(undefined));  // "undefined"
> 
> So, to me it seems like the WebIDL to ES mappings needs to treat
> undefined as present.

Agreed. Ad-hoc argument processing in JS today may use arguments.length, or undefined testing (possibly even null-or-undefined testing via " == null"). I continue to think arguments.length is the best way for IDL.

/be


> 
> erik
> 
> 
> 
> 
> 
> 
> 
> 
> On Tue, Oct 11, 2011 at 04:57, Mark S. Miller <erights@google.com> wrote:
>> On Tue, Oct 11, 2011 at 8:44 AM, Dominic Cooney <dominicc@google.com> wrote:
>>> 
>>> Since arguments.length isn't friendly to strict mode, this seems to be a
>>> good assumption for the future at the very least.
>> 
>> What's the issue with "arguments.length" in strict mode? Are you perhaps
>> thinking of arguments.callee and/or arguments.caller?
>> 
>> --
>>     Cheers,
>>     --MarkM
>> 
> 
Received on Tuesday, 11 October 2011 17:43:23 UTC

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