Allen Wirfs-Brock allen at
Fri Feb 24 16:19:34 PST 2012

On Feb 24, 2012, at 11:09 AM, Rick Waldron wrote:

> On Thu, Feb 23, 2012 at 3:15 PM, Erik Arvidsson <erik.arvidsson at> wrote:
> DOM4 added a new interface called DOMStringList for the sole reason
> that Array does not have contains. Before this the return type was an
> Array of Strings so we could use indexOf, map, forEach etc. Now that
> it is using a non Array we lost all of that.
> Wouldn't the return type (or [[Class]]) still be restricted from using "Array"? 
> From 8.6.2
> The value of the [[Class]] internal property is defined by this specification for every kind of built-in object. The value of the [[Class]] internal property of a host object may be any String value except one of "Arguments", "Array", "Boolean", "Date", "Error", "Function", "JSON", "Math", "Number", "Object", "RegExp", and "String". 
> So it can't be an "Array" by name, right?

It can be, as long as it really is a ES array.  "host object" doesn't mean any object created by the host.  It means new kinds of objects created by the host that implement primitive behaviors (generally internal methods) differently from what is specified by the ES spec.  

So, from the ES perspective, no problem.  When I originally asked the question I was thinking more about from the Web IDL perspective.  Does Web IDL require things (for example throwing if extra arguments are passed) that ES Arrays do not do.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the es-discuss mailing list