identity-hashcode ( obj -- code )
Factor documentation > Factor handbook > The language > Collections > Hashtables > Hashtable keys
Prev:hashcode* ( depth obj -- code )


Vocabulary
kernel

Inputs and outputs
objan object
codea fixnum


Word description
Outputs the identity hashcode of an object. The identity hashcode is not guaranteed to be unique, however it will not change during the object's lifetime.

See also
hashcode, hashcode*

Definition
USING: kernel.private ;

IN: kernel

: identity-hashcode ( obj -- code )
dup tag 0 eq? [
dup tag 1 eq?
[ drop 0 ] [
dup (identity-hashcode) dup 0 eq? [
drop dup compute-identity-hashcode
(identity-hashcode)
] [ nip ] if
] if
] unless ; inline