comp.lang.ada
 help / color / mirror / Atom feed
From: dewarr@my-dejanews.com
Subject: Re: Pb with use of redefined "=" operator
Date: 1998/11/04
Date: 1998-11-04T00:00:00+00:00	[thread overview]
Message-ID: <71onl2$jek$1@nnrp1.dejanews.com> (raw)
In-Reply-To: 363F62F3.3FF7@club-internet.fr

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    




  parent reply	other threads:[~1998-11-04  0:00 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-11-03  0:00 Pb with use of redefined "=" operator Fran�oise & Herv� BITTEUR
1998-11-04  0:00 ` Mats Weber
1998-11-04  0:00   ` Fran�oise & Herv� BITTEUR
1998-11-04  0:00 ` dewarr [this message]
1998-11-04  0:00   ` Tucker Taft
1998-11-04  0:00 ` Matthew Heaney
1998-11-04  0:00   ` Mats Weber
1998-11-05  0:00     ` Matthew Heaney
1998-11-05  0:00       ` dewarr
1998-11-05  0:00         ` Matthew Heaney
1998-11-06  0:00           ` dewarr
1998-11-09  0:00             ` Robert A Duff
1998-11-10  0:00               ` dennison
1998-11-10  0:00                 ` Robert A Duff
1998-11-05  0:00       ` Mats Weber
1998-11-05  0:00         ` Matthew Heaney
1998-11-09  0:00           ` Robert A Duff
1998-11-09  0:00             ` Brian Rogoff
1998-11-10  0:00               ` Robert A Duff
1998-11-10  0:00             ` Robert I. Eachus
replies disabled

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