Do array types have public interface objects?

The WebIDL draft specifies that an array type such as Attr[] (used by 
the DOM Core Element.attributes attribute) has the name "AttrArray" but 
it doesn't seem to require that there be an AttrArray interface object 
in the global scope as it does for regular interfaces.

On the other hand, instances of AttrArray don't inherit directly from 
Array.protoype.  Instead there is an array host object prototype object 
on the inheritance chain before Array.prototype. This suggests to me 
that perhaps the intent (not yet codified in the spec) is that this 
prototype object should be accessible as AttrArray.prototype.

As it stands now, if you want to define a property to be inherited by 
AttrArrays (and only AttrArrays) you'd have to first obtain an instance 
of AttrArray and use Object.getPrototypeOf() on it, which seems awkward.

If individual array types can be individually monkeypatched, then I 
think they deserve a public interface object.  On the other hand, if 
they don't have a public interface object, then wouldn't it be simpler 
to have them inherit directly from Array.prototype?

     David

Received on Monday, 20 June 2011 17:39:48 UTC