comp.lang.ada
 help / color / mirror / Atom feed
From: Vincent Marciante <marciant@li.net>
Subject: Re: Redefined "=" = generic disaster?
Date: 2000/10/22
Date: 2000-10-22T00:00:00+00:00	[thread overview]
Message-ID: <39F293C8.606E@li.net> (raw)
In-Reply-To: 39F255E7.38933FCC@acm.org

Jeff Carter wrote:
> 
> Vincent Marciante wrote:
> > Ugh!  So _are_ you saying that the Ada 83 code was defective wrt. Ada
> > 83?
> 
> In Ada 83, you could not redefine "=" for any type that could be used to
> instantiate the generic, so if you wrote "=" in the generic, it meant
> you wanted the predefined "=" for the type.

My point is that in Ada 83, if predefined "=" of a type did not agree
with the concept of equality that a designer intended for the type then
that designer should have eliminated it by declaring the type as
limitted private thereby not allowing it to be used to instantiate a
generic designed by someone else that imported a simple private type (I
say safely assuming that if the predefined "=" is available then it is a
semanticly correct eqality.)

(the first way that I tried to clarify my point follows - I'm still not
sure if either is clear enough, that why I didn't delete it.)

I understand this.  My point is that in Ada 83, if some one wanted to
create one ADT whose semantics required changing the condition for
equality then because it _had_ to be made limited private, the creater
of _some_another_ ADT could depend on the fact that even though a formal
equality operation was _not_ expliciely specified in _his_ ADT, using
the "=" associated with any formal private type was safe!  Or stated the
other way around, if the first guy's ADT's semantics were such that the
value returned by the predefined "=" for his type did not agree with the
semantics of the ADT that he was trying to design, then allowing "=" to
continue to exist (by not having used a limitted private type) would be
considered a defect in _his_ ADT - not a defect in an Ada 83 generic
unit that imported a mear private type (and implicitely assumably
semanticly correct equality operation of the type used to instantiate
his generic unit.) 

Do you see that I think that I am seeing a subtle issue about what could
be assumed in Ada 83 verse Ada 95.  


> This is still the case in
> Ada if you do not explicitly import "=". If, in Ada 83, you wanted some
> other behavior than the predefined "=", you still had to import it:
> 
> with function Equal (Left : T; Right : T) return Boolean;
> 
> The only real change in Ada is that now you can use the infix "=" to
> represent user-defined equality, while in Ada 83 you had to use
> something less intuitive. In either language, you get the predefined "="
> if you don't import something else, and have to import something else if
> you don't want the predefined behavior.
> 
> --
> Jeff Carter
> "I waggle my private parts at your aunties."
> Monty Python & the Holy Grail




      reply	other threads:[~2000-10-22  0:00 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-10-21  6:59 Redefined "=" = generic disaster? Vincent Marciante
2000-10-21  0:00 ` Jeff Carter
2000-10-21  0:00   ` Vincent Marciante
2000-10-28 11:12     ` Robert Dewar
2000-10-29  8:43       ` Vincent Marciante
2000-10-30  3:49       ` Lao Xiao Hai
2000-10-30 18:46         ` Robert Dewar
2000-10-31  3:27           ` Lao Xiao Hai
2000-10-31  6:54             ` Vincent Marciante
2000-10-31 19:51             ` Robert Dewar
2000-11-01 17:47               ` Mats Weber
2000-11-02  5:27                 ` Vincent Marciante
2000-11-02 16:52                   ` Mats Weber
2000-11-02 14:59                 ` Tucker Taft
2000-11-05  4:29                   ` Robert Dewar
2000-11-05  4:32                   ` Robert Dewar
2000-11-05  4:26                 ` Robert Dewar
2000-10-21  0:00   ` Vincent Marciante
2000-10-22  2:50     ` Jeff Carter
2000-10-22  0:00       ` Vincent Marciante [this message]
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox