Re: [WebIDL] Dictionaries and undefined

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