RE: [web-animations] Readonly interfaces and inheritance: seeking advice

From: Rik Cabanier [mailto:cabanier@gmail.com] 

> Don't do that just yet.
> Making them constructable will push their name in the global namespace. As you know, exposing a new name is a Big Deal. It's also unclear if anyone will call that constructor so this is just for theoretical purity.
> Instead, just mark them as [NoInterfaceObject]
 
I intend to spend (a lot) more time on this thread later, but first: this should not be true, even though it currently is in WebIDL. [NoInterfaceObject] vs. [Constructor] should be entirely orthogonal dimensions:

- [Constructor] decides whether the class's constructor executes real code, or just takes an unguessable secret/throws when it is not provided and does implementation-specific processes depending on global state to initialize itself.
- [NoInterfaceObject] decides whether the class's constructor is added to the global.

A class should be able to have a non-broken constructor without adding it to the global object. We can fix this in WebIDL fairly easily.

Also note, from WebIDL:

> The [NoInterfaceObject] extended attribute SHOULD NOT be used on interfaces that are not solely used as supplemental interfaces, unless there are clear Web compatibility reasons for doing so.

I haven't had time to look through the full of the OP, but perhaps the issue can be solved by making some of the interfaces in question supplemental interfaces, i.e. using `implements` instead of `:`, which makes them more of a mixin rather than a class. In that case [NoInterfaceObject] is appropriate (as it reinforces the mixin, not class, nature).

Received on Wednesday, 2 July 2014 12:51:58 UTC