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: dewarr@my-dejanews.com Subject: Re: Pb with use of redefined "=" operator Date: 1998/11/04 Message-ID: <71onl2$jek$1@nnrp1.dejanews.com>#1/1 X-Deja-AN: 408180705 References: <363F62F3.3FF7@club-internet.fr> X-Http-Proxy: 1.0 x4.dejanews.com:80 (Squid/1.1.22) for client 205.232.38.14 Organization: Deja News - The Leader in Internet Discussion X-Article-Creation-Date: Wed Nov 04 05:10:58 1998 GMT Newsgroups: comp.lang.ada X-Http-User-Agent: Mozilla/2.02 (OS/2; I) Date: 1998-11-04T00:00:00+00:00 List-Id: 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. -----------== Posted via Deja News, The Discussion Network ==---------- http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own