Re: Removal of identifierless getters, setters, etc.

On 10/12/10, Cameron McCormack <cam@mcc.id.au> wrote:
> At TPAC last year, there was a discussion on Web IDL that resulted in a
> resolution to remove special operations (getters, setters, etc.) that
> have no identifier:
>
>   http://www.w3.org/2009/11/02-webapps-minutes.html#item06
>
> I don’t see any rationale there, so I wonder if anyone who was there
> could explain?
>

I recall reading that document, e.g. "sequence is a JS array, array is
a host object" -- which jumped out at me at the time (because it is
false).

The "getter" "setter" in WebIDL is what is known as "catchall" in
ECMAScript[0]. It exists in browsers (as shown in some of the linked
examples), but it's not standard and has some problems (see Waldemar's
explanation on the proposal page[0]).

The problems are easily seen in with "has" checks e.g. "in" operator,
Array.prototype.indexOf, etc. I've been over this a few times already
on whatwg et al so I'll be brief and share some links with those
examples and explanations.

Mark Miller's also looked into this[4]:
| Catchalls are an excellent example issue for both points, in opposite
| directions. Regarding the second point, yes, we believe that new host
| APIs should generally seek to avoid requiring catchalls, since new
| native (i.e., written in EcmaScript) APIs must, and since there are
| many benefits to being able to emulate more host APIs more easily in
| EcmaScript (such as the ability to interpose intermediary wrappers).
| Regarding the first point, since legacy host APIs do require
| catchalls, EcmaScript must eventually too. The definition of how
| WebIDL-expressed catchalls map to future EcmaScript should co-evolve
| with the changes to EcmaScript needed to support this mapping.

Seems pretty obvious to me.

[0]http://wiki.ecmascript.org/doku.php?id=proposals:catchalls
[1]http://www.mail-archive.com/whatwg@lists.whatwg.org/msg22563.html
[2]http://www.mail-archive.com/whatwg@lists.whatwg.org/msg22680.html
[3]http://jibbering.com/faq/names/extra_props.html
[4]http://lists.w3.org/Archives/Public/public-webapps/2009JulSep/1332.html

Received on Thursday, 14 October 2010 03:02:46 UTC