12.3. The SYS Class

SYS defines a number of routines for accessing system information:

Operation in the SYS class

Routine

Description

is_eq(ob1, ob2:$OB):BOOL

Tests two objects for equality. If the arguments are of different type, it returns 'false'. If both objects are immutable, this is a recursive test on the arguments' attributes. If they are reference types, it returns 'true' if the arguments are the same object. It is a fatal error to call with external, closure, or void reference arguments.

is_lt(ob1, ob2:$OB):BOOL

Defines an arbitrary total order on objects. This never returns true if 'is_eq' would return true with the same arguments. It is a fatal error to call with external, closure, or void reference arguments.

hash(ob:$OB):INT

Defines an arbitrary hash function. For reference arguments, this is a hash of the pointer; for immutable types, a recursive hash of all attributes. Hash values for two objects are guaranteed to be identical when 'is_eq' would return true, but the converse is not true.

type(ob:$OB):INT

Returns the concrete type of an object encoded as an 'INT'.

str_for_type(i:INT):STR

Returns a string representation associated with the integer. Useful for debugging in combination with 'type' above.

destroy(ob:$OB)

Explicitly deallocates an object. Sather is garbage collected and casual use of 'destroy' is discouraged. Sather implementations provide a way of detecting accesses to destroyed objects (a fatal error).