Method lfun::`==()


Method `==

bool `==(mixed arg)

Description

Equivalence test callback.

Returns

Is expected to return 1 if the current object is equivalent to arg (ie may be replaced with arg, with no semantic differences (disregarding the effects of destruct())), and 0 (zero) otherwise.

Note

If this is implemented it may be necessary to implement lfun::__hash too. Otherwise mappings may hold several objects as indices which are duplicates according to this function. This may also affect various other functions that use hashing internally, e.g. Array.uniq.

Note

It's assumed that this function is side-effect free.

Note

It's recommended to only implement this function for immutable objects, as otherwise stuff may get confusing when things that once were equivalent no longer are so, or the reverse.

See also

`==(), lfun::__hash