comp.lang.ada
 help / color / mirror / Atom feed
From: bobduff@world.std.com (Robert A Duff)
Subject: Re: Operator visibility: why are modular types different??!
Date: 1996/05/04
Date: 1996-05-04T00:00:00+00:00	[thread overview]
Message-ID: <DqvwF5.Dnt@world.std.com> (raw)
In-Reply-To: 4mbcuu$4ne@fozzie.sun3.iaf.nl


In article <4mbcuu$4ne@fozzie.sun3.iaf.nl>,
Geert Bosch <geert@fozzie.sun3.iaf.nl> wrote:
>procedure UseTest is
>
>   package A is
>--      type I is range 0..2**32 - 1;   -- Program compiles with this def.
>      type I is mod 2**32;		-- This gives visibility error
>   end A;
>
>   package B is
>      subtype J is A.I;
>      use type J;
>   end B;
>
>   use B;
>
>   X   : J := 1;
>
>begin
>   if X /= 1 then

This is illegal.  The "use type J" makes the operators directly visible
inside B.  But use clauses are not transitive.  The "use B" makes things
declared in B directly visible.  It does not grab everything directly
visible in B.

If you moved the "use type J" outside B, then it would work.

There is no difference between signed integers and modular integers in
this respect.  So it sounds like it may be a compiler bug, that the
compiler didn't detect the error in the signed case.

- Bob




      reply	other threads:[~1996-05-04  0:00 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1996-05-03  0:00 Operator visibility: why are modular types different??! Geert Bosch
1996-05-04  0:00 ` Robert A Duff [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