From: geert@fozzie.sun3.iaf.nl (Geert Bosch)
Subject: Operator visibility: why are modular types different??!
Date: 1996/05/03
Date: 1996-05-03T00:00:00+00:00 [thread overview]
Message-ID: <4mbcuu$4ne@fozzie.sun3.iaf.nl> (raw)
Recently I encountered a really nasty problem, which I find hard
to work around. The situation is that I want to create a package
that provides some types which are subtypes of Interfaces.C.
(Example: subtype ULONG is Interfaces.C.unsigned_long)
I want these types to be subtypes instead of new types, so
the conversion functions from Interfaces.C can be used without
extra conversions.
On the other had, I want the user to directly use my ULONG type
without having to bother about Interfaces.C. To make operations
like = visible, I put ``use type ULONG'' in the spec of my package.
For normal integer types this works as expected, but not for modular
types. What's the difference and where can I find that in the RM?
Below is a complete example to make my problem clear. The compiler
is GNAT v3.01.
I'm really looking forward to an answer!
Regards,
Geert
PS. Please CC. to geert@sun3.iaf.nl since my news is unreliable :-(
(WARNING: THIS PROBABLY IS NOT VALID ADA CODE!)
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
null;
end if;
end UseTest;
--
E-Mail: geert@sun3.iaf.nl *** As far as we know, there have not been ***
Phone: +31-53-4303054 ** any undetected failures in our software. **
next reply other threads:[~1996-05-03 0:00 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
1996-05-03 0:00 Geert Bosch [this message]
1996-05-04 0:00 ` Operator visibility: why are modular types different??! Robert A Duff
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox