Array.prototype.contains

Allen Wirfs-Brock allen at wirfs-brock.com
Thu Nov 1 23:03:17 PDT 2012


On Nov 1, 2012, at 11:04 AM, Joshua Bell wrote:

> Bump.
> 
> I don't think Array.prototype.contains ever materialized on the "proposals" page, and hasn't shown up in an ES6 draft.
> 
> Officially out for ES6, stuck in the queue, or dropped on the floor?

Probably dropped on the floor, unless somebody can find something about it in meeting notes.

It looks to me from scanning just this thread that it was an idea that was floated here with generally positive responses, but had some unresolved issues, and nobody ever signed on as champion to write an actual proposal.  

Allen







> 
> On Fri, Feb 24, 2012 at 4:40 PM, Rick Waldron <waldron.rick at gmail.com> wrote:
> Allen, thank you for the clarification there
> 
> 
> Rick
> 
> 
> On Feb 24, 2012, at 7:19 PM, Allen Wirfs-Brock <allen at wirfs-brock.com> wrote:
> 
>> 
>> 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 gmail.com> 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.
>> 
>> 
>> Allen
> 
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
> 
> 
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20121101/75906f3c/attachment.html>


More information about the es-discuss mailing list