Array.prototype.contains

Andrea Giammarchi andrea.giammarchi at gmail.com
Fri Nov 2 09:37:03 PDT 2012


I was wondering the same ... if `contains()` is the new indexOf then why
other collections are using `has()` ... I like has() more but it might be
me lazy typer ... still it should be consistent.


On Fri, Nov 2, 2012 at 9:14 AM, Rick Waldron <waldron.rick at gmail.com> wrote:

>
>
> On Fri, Nov 2, 2012 at 11:25 AM, Allen Wirfs-Brock <allen at wirfs-brock.com>wrote:
>
>> There is also the compat issue with Mootools  with String contains...
>>
>> If we decided we needed to rename String contains then it might also
>> impact what we call a similar Array method
>>
>
>
> Perhaps it should be "has" instead of "contains"? Consistent with the
> other "collections".
>
> Rick
>
>
>>
>> Allen
>>
>>
>>
>> On Nov 2, 2012, at 8:19 AM, Erik Arvidsson wrote:
>>
>> I'll put up a proposal once electricity is back. I'll use the same
>> comparison as done in maps.
>> On Nov 2, 2012 2:03 AM, "Allen Wirfs-Brock" <allen at wirfs-brock.com>
>> wrote:
>>
>>>
>>> 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
>>>
>>>
>>>
>>> _______________________________________________
>>> 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
>>
>>
>
> _______________________________________________
> 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/20121102/92fc51c5/attachment-0001.html>


More information about the es-discuss mailing list