Scrapped using a Comparable for the keys to a DSet on this side of things.
- There is no such thing as Comparable in ActionScript, I had made my own, but String (one of the most common keys) couldn't implement it, and String is a final class (like in Java). It would be a huge inconvenience to have to wrap String objects. - The language also has no .equals() method in the base class. The strict equality operator (===) works like equals() except that objects that aren't one of the base types (String, Number, Boolean, int) are compared by reference. I added a "Equalable" interface, if the key in a DSet implements that interface then equals() is called, otherwise the strict equality operator is used. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@3897 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
package com.threerings.util {
|
||||
|
||||
/**
|
||||
* An interface we can use to implement equals(), which is standard and
|
||||
* very useful in Java.
|
||||
*/
|
||||
public interface Equalable {
|
||||
/**
|
||||
* Return true to see if this instance is equal to the specified object.
|
||||
*/
|
||||
function equals (other :Object) :Boolean;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user