Skip to content

SAME_OBJECT

Info

New in Atfinity 17.

Description

SAME_OBJECT takes two values and is true when they are the same thing, rather than two things that happen to hold the same values. It is the counterpart of =, which compares what a value contains.

For an instance that means the same instance, and for a structure occurrence the same occurrence. An occurrence keeps that identity when it is read from the previous state of its instance and when it moves to another position in the list, so the comparison follows the occurrence rather than its index.

Anything that is neither an instance nor an occurrence has no identity apart from its value, so SAME_OBJECT compares those the way = does. It is unknown when either side is unknown.

Example

p is Person
has_changed(p.addresses)
and SAME_OBJECT(OLD.p.addresses[0], p.addresses[0])

True for a client whose address list changed while the first address is still the one the last approved case left behind, so the change happened further down the list. Once somebody puts a different occurrence in first position the second line turns false, even where the new occurrence holds exactly the values the old one held.

Use = where the question is about the values rather than the occurrence:

p is Person
p.addresses[0] = p.addresses[1]

True for a client who entered the same address twice, which is the duplicate worth cleaning up before the case goes on. Two occurrences of one list are never the same occurrence, so SAME_OBJECT is false for any two positions of the same list and adds nothing here.