equality
Ken Sailor
sailor@sask.trlabs.ca
Fri, 4 Jul 1997 11:02:20 -0600 (CST)
Of course, as soon as I mailed my response I understand there is a deeper
question: If you want to define a class equality that is symmetric,
reflexive, and transitive, how do you do so? Certainly would be nice,
and would make reasoning about the class easier with such guarantees.
I think the answer is that you can't provide such guarantees in a class
definition.
The programmer when defining an instance of equality "should" provide a
definition in the spirit of equality, but the compiler can not ensure that
the definition satisfies such restrictions as x==x for all x of the
instance type.
Ken
------------------------------------------------------------------
Ken Sailor sailor@cs.usask.ca
sailor@sask.trlabs.ca
HyperCore Technology Inc. University of Saskatchewan
Senior Software Analyst Adjunct Professor
phone 1-306-668-8218 fax 1-306-668-1944