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,ef86287aa487b07a X-Google-Attributes: gid103376,public From: stt@houdini.camb.inmet.com (Tucker Taft) Subject: Re: Pb with use of redefined "=" operator Date: 1998/11/04 Message-ID: #1/1 X-Deja-AN: 408331386 Sender: news@inmet.camb.inmet.com (USENET news) X-Nntp-Posting-Host: houdini.camb.inmet.com References: <71onl2$jek$1@nnrp1.dejanews.com> Organization: Intermetrics, Inc. Newsgroups: comp.lang.ada Date: 1998-11-04T00:00:00+00:00 List-Id: dewarr@my-dejanews.com wrote: : In article <363F62F3.3FF7@club-internet.fr>, : hbitteur@club-internet.fr wrote: : > I just run in a problem when combining : : > - Ada.Strings.Bounded where '=' operator is redefined, : > - A so far correct generic package (old Ada83 code) importing a private : > (non-limited) type. : > : > The problem is that any instantiation of the generic package will use : > the "predefined" equality operator provided with any non-limited type, : > rather than the specific definition related to Ada.Strings.Bounded. : > Which leads to unexpected results on some occasions. : > : > But what puzzles me is that : : > 1/ No warning is raised by the compiler (how could it be otherwise ?) : > 2/ Correct code (till now) has silently got broken. : No warning is issued because there is nothing wrong with your code. : Your program was correct Ada before the change and it is correct : Ada after the change. The RM quite clearly defines that the : predefined equality relation is the one used. The only thing : broken is your understanding and expectations! : To be fair, this often surprises people, but that is the way : the language is designed (for good reasons). : You should pass in the equality operation explicitly to the : generic if that is what you want. I might add that the Ada Rapporteur Group (ARG) is considering a binding interpretation (binding AI) to the language which would require that all non-limited types in language-defined packages (such as Ada.Strings.Bounded) have "=" operators that compose properly, and work "right" in a generic as well. This would eliminate the issue for language-defined types at least. -- -Tucker Taft stt@inmet.com http://www.inmet.com/~stt/ Intermetrics, Inc. Burlington, MA USA An AverStar Company