Array.prototype.contains solutions

Brendan Eich brendan at
Tue Jan 20 10:24:26 PST 2015

Domenic Denicola wrote:
>  leads to  which is probably what you were thinking of.
> They were not very good ideas.

It's a hard problem. Original-JS2/ES4 had namespaces, after Common Lisp 
symbol packages, as a proposed solution. You'd have to open a namespace, 

   use namespace intrinsic;
   if (myArray.contains(someValue)) ...;

or explicitly quality:

   if (myArray.intrinsic::contains(someValue)) ...;

in case you needed to mix MooTools' contains with the new built-in one.

Namespaces were decisively rejected from the Harmony agenda at its 
founding in Oslo, July 2008:

General hacks tend to generalize to namespaces if you push them. 
Specific hacks as you say are not very good ideas. This leaves picking 
good-enough names that don't collide. AFAIK this is the state of the 
art. Just recapitulating for anyone new to es-discuss, and calling for 
better ideas. Thanks,


More information about the es-discuss mailing list