Re: Feature-detectable API extensions?

On 8/28/13 12:24 AM, Allen Wirfs-Brock wrote:
> I think that the appropriate translation of WebIDL to ES6 is that WebIDL "optional" always turns into an ES6 parameter with a default value initializer.

Why is that?  I'd like to understand the reasoning...

> If the WebIDL source includes an explicit default value then that value should be used as the ES6 default value.  If the WebIDL does not have an explicit default value then the implicit WebIDL default should be used as the ES6 default value.

There is no implicit WebIDL default value.  If there is no default 
value, then the argumen is "not passed" just like it would be undefined 
in a JS function.

> If you do this, then the WebIDL length based upon "optional" should match the ES8 length based upon default value initializers.

I agree, but should that be the goal?  Or would a better definition of 
"length" make sense for WebIDL (e.g. counting optional args without 
default values in the length)?

-Boris

Received on Wednesday, 28 August 2013 05:03:53 UTC