Garrett dhtmlkitchen at gmail.com
Mon Jul 16 15:02:34 PDT 2007

Jason Orendorff wrote:
> On 7/13/07, Garrett <dhtmlkitchen at gmail.com> wrote:
>> For collections, it would be very useful to have a natively-supported
>> equals() method.
> ECMAScript 4 has operator overloading.  You can just override the ==
> operator.
>> It would also be very useful to have native collections. Object and Array
>> are limited.
> J: What limitations are you referring to?
> SortedSet is kind of a pain to hand-write in JavaScript and you have to
> check type every time. This won't change in ES4; typed arrays have been
> dropped. 
> For SortedSet, operations can execute more quickly than with n-time Array
> lookups like with anArray.indexOf. 
> Method equals would be useful for a SortedSet. You could easily use
> valueOf or a comparator to compare the two objects for add/remove type of
> operations, but for something like a set of case-insensitive strings,
> overriding equals for the CaseInsensitiveString class would make it easier
> for contains type of operations. 
> I am understanding now that ES4 allows for operator overloading. Thank
> you. It would be nice to have collections to rely on a common interface
> for objects. I think equals method would be a good compliment to the
> existing valueOf method. 
> J: ECMAScript 4 adds new Array methods, a new "for each" statement, and
> probably a standard Dictionary class.
> I did not see the Dictionary class definition. in the spec here: 
> (long, 1-page:
> http://www.mozilla.org/js/language/es4.html#formal_parser-grammar_N-FunctionExpression
> )
> (A search box on the spec would be nice).
> I would also love to see enums. I would use them for Event types and
> places where I use an object with constants. 
> -j
> Garrett
> _______________________________________________
> Es4-discuss mailing list
> Es4-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es4-discuss

View this message in context: http://www.nabble.com/Object.prototype.equals-tf4077453.html#a11631842
Sent from the Mozilla - ECMAScript 4 discussion mailing list archive at Nabble.com.

More information about the Es4-discuss mailing list