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,MAILING_LIST_MULTI, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,18f7f6e041b3e0bf,start X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-07-23 22:38:06 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!isdnet!137.194.32.100.MISMATCH!enst.fr!not-for-mail From: "Grein, Christoph" Newsgroups: comp.lang.ada Subject: Re: Dispatching and generics - language lawyer question Date: Wed, 24 Jul 2002 07:33:46 +0200 (MET DST) Organization: ENST, France Sender: comp.lang.ada-admin@ada.eu.org Message-ID: Reply-To: comp.lang.ada@ada.eu.org NNTP-Posting-Host: marvin.enst.fr Mime-Version: 1.0 Content-Type: TEXT/plain; charset=us-ascii X-Trace: avanie.enst.fr 1027489085 25844 137.194.161.2 (24 Jul 2002 05:38:05 GMT) X-Complaints-To: usenet@enst.fr NNTP-Posting-Date: Wed, 24 Jul 2002 05:38:05 +0000 (UTC) Return-Path: X-Authentication-Warning: mail.eurocopter.com: uucp set sender to using -f Content-MD5: Ixp/Ad0+z1vpdqn0gec2gQ== X-Mailer: dtmail 1.2.1 CDE Version 1.2.1 SunOS 5.6 sun4u sparc Errors-To: comp.lang.ada-admin@ada.eu.org X-BeenThere: comp.lang.ada@ada.eu.org X-Mailman-Version: 2.0.11 Precedence: bulk X-Reply-To: "Grein, Christoph" List-Help: List-Post: List-Subscribe: , List-Id: comp.lang.ada mail<->news gateway List-Unsubscribe: , Errors-To: comp.lang.ada-admin@ada.eu.org X-BeenThere: comp.lang.ada@ada.eu.org Xref: archiver1.google.com comp.lang.ada:27346 Date: 2002-07-24T07:33:46+02:00 > There is a problem with "reemergence" of predefined operators ... For untagged types, _redefined_ equality does not correctly compose and _predefined_ equality reemerges in generics if not properly transferred by a formal parameter: type X is something; function "=" (L, R: X) return Boolean; -- redefine type Y is record C: X; end record; A, B: Y; L: Boolean := A = B; -- here predefined "=" on component C is used, not the -- equality redefined above generic type T is private; --with function "=" (L, R: T) return Boolean is <>; package P is ... package P_on_X is new P (X); -- here also predefined "=" on X is used, -- not the equality redefined above You have to uncomment the generic parameter function to prevent reemergence. This whole astonishing rule has been introduced because of compatibility with Ada 83 (note there were no tagged types in Ada 83 so there reemergence could safely be avoided). In Ada 83, it was not possible to redefine "=" without using a trick (I do not remember the exact way to do it, I never did this; you have to use generics with the a limited private formal type). When you used this trick to redefine equality, also the predefined equality reemerged as in the cases above. Thus for compatibility, we have this rule in Ada 95.