comp.lang.ada
 help / color / mirror / Atom feed
* Operator visibility: why are modular types different??!
@ 1996-05-03  0:00 Geert Bosch
  1996-05-04  0:00 ` Robert A Duff
  0 siblings, 1 reply; 2+ messages in thread
From: Geert Bosch @ 1996-05-03  0:00 UTC (permalink / 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. **




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~1996-05-04  0:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1996-05-03  0:00 Operator visibility: why are modular types different??! Geert Bosch
1996-05-04  0:00 ` Robert A Duff

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