class ELT_HASH
****
Provides the hash value of an object. Returns the user defined hash value, if there is one (i.e. the object subtypes from $HASH) Otherwise provides a system defined hash value.


Flattened version is here



Public


Features
elt_hash(e:$OB):INT
**** The default hash value of an object "e". Uses the user defined hash function if e < $HASH. Otherwise, uses the system defined hash function.
_
If e < $IS_EQ, then the system defined hash function will not be used, since it may not be valid. An exception will be raised. The hash function must maintain the property that
__________a=b_=>_a.hash=b.hash
However, if the user has redefined equality, there is no way for the system to guarantee that any hash values it provides preserve the above property, except by returning the same value every time (which is correct, but useless for hashing).
_
Due to a current limitation of the compiler, the system defined hash function will not work on immutable classes. Hence, immutable classes must define their own hash function and be under $HASH
_


Private

verify_can_call_hash(e:$OB):BOOL
**** Check that "e" is of a reference type. If not, raise an error

The Sather Home Page