[net.lang.ada] Overloading the equality operator

gary@telesoft.UUCP (Gary Dismukes @lizard) (09/29/86)

Regarding Roger Racine's question about the use of predefined equality:

It is true that a predefined equality operator is implicitly declared
by the declaration of any access type.  However, if an explicit "="
function has been declared for the (limited) private type to which the
access type corresponds, then the predefined equality operator will
be hidden throughout its scope.  This is because the "=" function and
the predefined equality operator are homographs occurring immediately
within the same declarative region and thus the operator will be hidden
by the function (see RM 8.3, paragraph 17).  Note that for two overloadable
declarations to be homographs they need only have the same identifier,
operator symbol, or character literal and the same parameter and result
type profile (see RM 8.3, paragraph 15 and 6.6).  The names of parameters
are not used to determine whether two declarations have the same profile
and that is why it is not sufficient to provide different parameter names
for the "=" function in order to get at the predefined equality operator.
Since the predefined operator cannot be named once it has been hidden in
this way, it is necessary to resort to the derived type solution (or some-
thing less desirable like an unchecked conversion).


Gary Dismukes
TeleSoft

gary@telesoft.uucp                          ucbvax--|   hp-sdd--|
telesoft!gary@ucsd.arpa                     decvax--+--sdcsvax--+--telesoft
                                            ihnp4--|  noscvax--|