From: Stuart Palin <stuart.palin@gecm.com>
Subject: Re: 'with'ing and 'use'ing
Date: 2000/03/09
Date: 2000-03-09T00:00:00+00:00 [thread overview]
Message-ID: <38C795F3.9D0DCD39@gecm.com> (raw)
In-Reply-To: 8a6fsj$6dr$1@nnrp1.deja.com
Robert Dewar wrote:
>
> In article <38C52D30.E1C7E85A@gecm.com>,
> Stuart Palin <stuart.palin@gecm.com> wrote:
>
> > It seems to me that the points raised in the c.l.a thread
> > "choice of fixed point type" highlight an area where the "use"
> > clause can give rise to some concerns.
>
> Nope, you are misreading the thread. This thread was about
Quite possibly!
> a) ambiguities not detected that should be. Obviously adding
> use clauses NEVER causes undetected ambiguities.
True - because the compiler is supposed to report an error if there is
an ambiguity.
> b) the concern that certain expressions are compiled
> misleadingly because only one fixed-point type is
> visible. Use clauses can *only* help in this regard.
This is more the area I was concerned with.
First a caveat - I am working with Ada-83, and I do not know whether
what follows works
differently under Ada-95.
Suppose I (rather pathologically) have:
package P1 is
type Gx is range -1000..1000;
function I return Gx;
function K return float;
end P1;
package P2 is
type Fx is delta 0.1 range -200.0 .. 200.0;
function I return Fx;
function K return Fx;
end P2;
And then I start writing a new package:
package P3 is
end P3;
with P1, P2; use P1,P2;
package body P3 is
X : float;
begin
-- Now I "intend" to do : X := float(P1.I) * P1.K;
-- But foolishly write:
X := float(I * K);
-- This will be compiled (under Ada-83) as : X := float(P2.I *
P2.K);
end P3;
If I had written (what I probably should have written if I did not
believe there was an
ambiguity due to P2 being in scope)
X := float(I) * K;
then the compiler would have warned me about the ambiguity (at least of
I).
I believe it is a concern that a mistake can be hidden, because another
valid (but unexpected) meaning can be "found" by the compiler, that
leads people to "distrust" using "use".
Regards
--
Stuart Palin
BAE SYSTEMS Electronics Limited
prev parent reply other threads:[~2000-03-09 0:00 UTC|newest]
Thread overview: 55+ messages / expand[flat|nested] mbox.gz Atom feed top
2000-02-29 0:00 'with'ing and 'use'ing Roger Hoyle
2000-02-29 0:00 ` Ted Dennison
2000-03-01 0:00 ` Robert Dewar
2000-03-01 0:00 ` Ted Dennison
2000-03-01 0:00 ` Robert Dewar
2000-03-01 0:00 ` Ted Dennison
2000-03-01 0:00 ` Wes Groleau
2000-03-02 0:00 ` Robert Dewar
2000-02-29 0:00 ` xl
2000-02-29 0:00 ` Jeffrey Carter
2000-02-29 0:00 ` xl
2000-03-01 0:00 ` Roger Hoyle
2000-02-29 0:00 ` David Starner
2000-02-29 0:00 ` Robert A Duff
2000-02-29 0:00 ` Ted Dennison
2000-03-01 0:00 ` Robert Dewar
2000-02-29 0:00 ` Jeffrey Carter
2000-02-29 0:00 ` Brian Rogoff
2000-03-01 0:00 ` Jean-Pierre Rosen
2000-03-02 0:00 ` Charles Hixson
2000-03-02 0:00 ` Robert A Duff
2000-03-02 0:00 ` Ted Dennison
2000-03-02 0:00 ` Charles Hixson
2000-03-02 0:00 ` David Starner
2000-03-03 0:00 ` Ted Dennison
2000-03-07 0:00 ` Nick Roberts
2000-03-03 0:00 ` Jeff Carter
2000-03-03 0:00 ` David Starner
2000-03-04 0:00 ` Simon Wright
2000-03-03 0:00 ` Marin D. Condic
2000-03-03 0:00 ` Scott Ingram
2000-03-04 0:00 ` Simon Wright
2000-03-03 0:00 ` Larry Kilgallen
2000-03-04 0:00 ` Robert Dewar
2000-03-04 0:00 ` Ehud Lamm
2000-03-06 0:00 ` Charles Hixson
2000-03-06 0:00 ` Robert Dewar
2000-03-03 0:00 ` Charles H. Sampson
2000-03-04 0:00 ` Jean-Pierre Rosen
2000-03-06 0:00 ` Ted Dennison
2000-03-06 0:00 ` Robert Dewar
2000-03-07 0:00 ` Ted Dennison
2000-03-08 0:00 ` Robert Dewar
2000-03-11 0:00 ` Robert A Duff
2000-03-06 0:00 ` Ted Dennison
2000-03-06 0:00 ` Robert Dewar
2000-03-07 0:00 ` Marin D. Condic
2000-03-07 0:00 ` Ted Dennison
2000-03-06 0:00 ` Robert A Duff
2000-03-06 0:00 ` tmoran
2000-03-07 0:00 ` Marin D. Condic
2000-03-06 0:00 ` Charles H. Sampson
2000-03-07 0:00 ` Stuart Palin
2000-03-08 0:00 ` Robert Dewar
2000-03-09 0:00 ` Stuart Palin [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