W3C home > Mailing lists > Public > public-script-coord@w3.org > January to March 2014

Re: Removing the concept of "optional any"

From: Boris Zbarsky <bzbarsky@MIT.EDU>
Date: Wed, 19 Feb 2014 12:26:46 -0500
Message-ID: <5304E956.6050909@mit.edu>
To: Domenic Denicola <domenic@domenicdenicola.com>, Allen Wirfs-Brock <allen@wirfs-brock.com>, "Mark S. Miller" <erights@google.com>
CC: "public-script-coord@w3.org" <public-script-coord@w3.org>
On 2/19/14 12:19 PM, Domenic Denicola wrote:
> At first glance, to me, "any" would mean "anything except `undefined`" and "optional any" would mean "anything, including `undefined` to trigger defaults."

This would be the other proposal, yes.  Unfortunately, it's not clear to 
me that this change would necessarily be web-compatible unless we 
changed the existing "any" in postMessage and probably some other places 
(where it's not in trailing position) to "optional any"...

There's another thing worth keeping in mind here, which Allen raised. 
We may want WebIDL to be able to express the "normal" behavior of ES 
functions so that it's possible to use WebIDL to bare-bones describe 
things that might happen to be specified in ECMASpeak or some other 
formalism.  If so, it seems like that behavior would more or less map to:

1)  "any" is allowed, affects .length if trailing, accepts all ES 
values, does NOT trigger an argc check.  Defaults to undefined if not 
passed explicitly.

2)  "optional any" is allowed, does not affect .length if trailing, 
accepts all ES values, defaults to the provided default value, or 
undefined if no default value is provided, if not passed explicitly.

Then your typical ES function like so:

   function f(arg1, arg2=5, arg3=undefined) {}

would look like:

   void f(any arg1, optional any arg2 = 5, optional any arg3);

and have length == 1.

Received on Wednesday, 19 February 2014 17:27:19 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 17:14:19 UTC