comp.lang.ada
 help / color / mirror / Atom feed
From: stt@houdini.camb.inmet.com (Tucker Taft)
Subject: Re: Pb with use of redefined "=" operator
Date: 1998/11/04
Date: 1998-11-04T00:00:00+00:00	[thread overview]
Message-ID: <F1wn7D.KAG.0.-s@inmet.camb.inmet.com> (raw)
In-Reply-To: 71onl2$jek$1@nnrp1.dejanews.com

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




      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 ` Matthew Heaney
1998-11-04  0:00   ` Mats Weber
1998-11-05  0:00     ` Matthew Heaney
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
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-04  0:00 ` Mats Weber
1998-11-04  0:00   ` Fran�oise & Herv� BITTEUR
1998-11-04  0:00 ` dewarr
1998-11-04  0:00   ` Tucker Taft [this message]
replies disabled

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