P
Peter Judge
Guest
The PLO currently provides an overridable Equals() method which, in its default implementation, performs a reference comparison: that is, the 2 object instances being compared must be the exact same object (ie the exact "handle" or reference). A deep equality method would compare 2 different instances of an object, not just at the reference level, but comparing the 2 objects' state. An initial use-case for this is in testing, where an object of known state can be compared to the result of a test. Currently, ABL developers must implement this deep equality in the Equals() method override, and do it for each type that they would like to compare. This is time consuming and somewhat error-prone, since Equals() is in the PLO type and always exists - there is no way to determine at runtime whether a type has overridden Equals() and so no way to be sure that the type is not simply performing a reference/default comparison. A deep equality check would potentially have a performance impact, since it might need to traverse large object trees. But this would be a known fact (indicated by the name and documentation) and so calling DeepEquals() would be a conscious decision. An alternative name for this might be MemberwiseEquals() or similar.
Continue reading...
Continue reading...