***SPAM*** Object.prototype.equals

Garrett dhtmlkitchen at gmail.com
Fri Jul 13 16:38:13 PDT 2007


Been reading these posts for a while now. Very interesting stuff here! Sad to
say that Microsoft still has some horrible bugs in it's current JScript
engine, with buggy support of ECMA-262.

For collections, it would be very useful to have a natively-supported
equals() method. 

The method would return true when two variables point to the same object.
Basically, the equivalent of:

Object.prototype.equals = function( other ) {
    return this === other;
};

This way, collections could override it. If you think about it, we already
have valueOf method that can compare objects using <= and >= or the -
operator.

function compare( objectA, objectB ) {
  return objectA.valueOf() - objectB.valueOf(); 
};

It would also be very useful to have native collections. Object and Array
are limited. 


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




More information about the Es4-discuss mailing list