From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,8ffd9ca0013db6a7 X-Google-Attributes: gid103376,public From: Vincent Marciante Subject: Re: Redefined "=" = generic disaster? Date: 2000/10/22 Message-ID: <39F293C8.606E@li.net>#1/1 X-Deja-AN: 684362691 Content-Transfer-Encoding: 7bit References: <39F13ED9.1EE@li.net> <39F1C092.87D4135E@acm.org> <39F1DCFD.3276@li.net> <39F255E7.38933FCC@acm.org> Content-Type: text/plain; charset=us-ascii X-Complaints-To: abuse@verio.net X-Trace: iad-read.news.verio.net 972198832 209.139.0.59 (Sun, 22 Oct 2000 07:13:52 GMT) Organization: Verio MIME-Version: 1.0 NNTP-Posting-Date: Sun, 22 Oct 2000 07:13:52 GMT Newsgroups: comp.lang.ada Date: 2000-10-22T00:00:00+00:00 List-Id: 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