comp.lang.ada
 help / color / mirror / Atom feed
From: Leo Brewin <leo.brewin@internode.on.net>
Subject: Re: Is this a bug in Ada.Numerics?
Date: Sat, 20 Oct 2012 19:32:36 -0700 (PDT)
Date: 2012-10-20T19:32:36-07:00	[thread overview]
Message-ID: <0360d84c-ef42-4107-b837-4063da273ad8@googlegroups.com> (raw)
In-Reply-To: <87wqykd1wv.fsf@ludovic-brenta.org>

Hi Ludovic,

Thanks for the quick and detailed response. Your suggestion (3) and (4) certainly do fix the problem but I was posing the original code (in its less than ideal form) as a way to understand how the compiler sorts out these scoping/visibility issues. In my real code I would do as you suggest.

But having digested your answer I'm still a bit confused (sorry). Here is the "procedure" version of the above package,

   with Ada.Numerics.Generic_Complex_Types;
   with Ada.Numerics.Generic_Complex_Elementary_Functions;

   procedure foo is

      type Real is digits 18;
		
      package Complex_Types is new 
         Ada.Numerics.Generic_Complex_Types (Real);

      use foo.Complex_Types;
      subtype Complex is foo.Complex_Types.Complex;
      
      procedure bar (z : in out Complex);
   
      package Complex_Maths is new 
         Ada.Numerics.Generic_Complex_Elementary_Functions (Complex_Types);
   
      procedure bar (z : in out Complex) is
      begin
         z := Complex'(Re(z),0.0);
      end bar;

   begin
      null;
   end foo;

This does compile and yet (by my reading of your reply) the "use foo" and "subtype complex" lines should introduce two distinct versions of Complex and thus should produce a compiler error.

I'm sure I've got this wrong, my apologies for wasting your time...

Cheers,
Leo



  reply	other threads:[~2012-10-21  2:32 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-21  0:37 Is this a bug in Ada.Numerics? Leo Brewin
2012-10-21  1:54 ` Yannick Duchêne (Hibou57)
2012-10-21  2:39   ` Leo Brewin
2012-10-21  1:55 ` Ludovic Brenta
2012-10-21  2:32   ` Leo Brewin [this message]
2012-10-21  3:39     ` Ludovic Brenta
2012-10-21  3:54       ` Leo Brewin
2012-10-21  8:59       ` Georg Bauhaus
2012-10-23 15:48       ` Vincent Marciante
2012-10-23 22:52       ` Leo Brewin
2012-10-23 23:09         ` Jeffrey Carter
replies disabled

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