Re: Removing the concept of "optional any"

On Feb 19, 2014, at 8:28 AM, Mark S. Miller wrote:

> Hi Boris,
> 
> Everything here seems good and compat except the .length issue. Wouldn't this change cause existing .length values to change, without any other observable effect on semantics?

That's my concern, too.

if you were defining such a function in ES6, you might either write:

function f(arg) { }  //this feels like 'any arg'
   //f.length is 1

or 

function f(arg=undefined) {}  //this feels like 'optional any arg'
//  f.length is 0

The only real difference between the two is the value of the length property.  However, I think the two declarations (and the associated length value) conveys a different usage expectation.  The first form tells a developer that the common usage is to pass an argument The second form tells a a developer that in common cases an argument is not required.

If you haven't done so, it might be useful to write out for all the  WebIDL signature forms the equivalent ES6 function declarations that you would expect somebody to use when implementing  that WebIDL signature.


Allen

Received on Wednesday, 19 February 2014 17:15:49 UTC