comp.lang.ada
 help / color / mirror / Atom feed
From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: ANN: Ada 2005 Math Extensions, 20100810 release
Date: Fri, 13 Aug 2010 10:40:57 +0200
Date: 2010-08-13T10:40:56+02:00	[thread overview]
Message-ID: <mquqzujv915o.1d7s3beao5yzk.dlg@40tude.net> (raw)
In-Reply-To: 4c64f756$0$6985$9b4e6d93@newsspool4.arcor-online.net

On Fri, 13 Aug 2010 09:42:15 +0200, Georg Bauhaus wrote:

> On 8/13/10 8:27 AM, Dmitry A. Kazakov wrote:
> 
>> Another rule of thumb (I don't know if this is going to be fixed in Ada
>> 2012), is that a child should always rename formal generic arguments in its
>> specifications. Under certain circumstances, usually in children, they
>> might become unavailable. I mean this:
> 
> Would you mind showing an example of a name that is needed
> but unavailable?

>> generic
>>     with package P is new Generic_P (<>);
>> package Generic_S is
>>     package P_Of renames P; -- You will need this!

Do you mean the use case or the offending code? I cannot say for the latter
because I have no idea when it happens and if the code is legal [*]. The
simplest possible use case is the diamond diagram of generic packages [**]:

  A
 / \
B  C
 \ /
  D

In the specification of D you have to constrain B and C to the same A. For
this you will need to refer the parameters of B and C:

   generic
   package A is end A;

   generic
      with package AA is new A (<>);
   package B is end B;

   generic
      with package AA is new A (<>);
   package C is end C;

   generic
      with package BB is new B (<>);
      with package CC is new C (BB.AA);
         -- Somewhere, somehow this ceases to work
   package D is end D;

Note that Simon's problem is the same use case (just one shoulder of the
diagram) but of different shape [*]:

   generic
   package A is end A;

   generic
   package A.B is end A.B;

   generic
   package A.C is end A.C;

   with A.B, A.C;
   generic
      with package AB is new A.B (my own A); -- No way!
      with package AC is new A.C (my own A); -- No way!
   package A.D is end D;

-----------
* Generics is a mess, remember?
** We were told how dreadful the diamond is, so bad that Ada may not allow
to have MI, but for sacred generics anything is perfectly OK!

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de



  reply	other threads:[~2010-08-13  8:40 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-10 21:38 ANN: Ada 2005 Math Extensions, 20100810 release Simon Wright
2010-08-11 11:40 ` Ada novice
2010-08-11 21:38 ` Simon Wright
2010-08-12  5:57   ` Dmitry A. Kazakov
2010-08-12 19:45     ` Simon Wright
2010-08-13  6:27       ` Dmitry A. Kazakov
2010-08-13  6:54         ` Ludovic Brenta
2010-08-13 13:36           ` Yannick Duchêne (Hibou57)
2010-08-13  7:42         ` Georg Bauhaus
2010-08-13  8:40           ` Dmitry A. Kazakov [this message]
2010-08-13 13:41             ` Yannick Duchêne (Hibou57)
2010-08-13 13:57               ` Dmitry A. Kazakov
2010-08-13 13:31         ` Yannick Duchêne (Hibou57)
2010-08-13 13:48           ` Dmitry A. Kazakov
2010-08-13 19:50         ` Simon Wright
2010-08-13 20:17           ` Yannick Duchêne (Hibou57)
2010-08-13 22:04             ` Simon Wright
2010-08-13 22:28               ` Yannick Duchêne (Hibou57)
2010-08-13 22:30                 ` Yannick Duchêne (Hibou57)
2010-08-14 16:12                 ` Simon Wright
2010-08-14 17:16                   ` Dmitry A. Kazakov
2010-08-14 17:34                     ` Jeffrey Carter
2010-08-14 19:18                       ` Simon Wright
2010-08-14 23:51                         ` Georg Bauhaus
2010-08-15  0:57                           ` Yannick Duchêne (Hibou57)
2010-08-15  2:27                           ` Jeffrey Carter
2010-08-12 10:36   ` Stephen Leake
2010-08-12 12:48     ` sjw
2010-08-14  1:05       ` Stephen Leake
2010-08-14 16:26         ` Simon Wright
2010-08-14 17:24           ` Dmitry A. Kazakov
2010-08-14 19:16             ` Simon Wright
2010-08-14 20:48               ` Dmitry A. Kazakov
2010-08-14 21:55                 ` Simon Wright
2010-08-15  6:14                   ` Dmitry A. Kazakov
2010-08-15 17:06                     ` Simon Wright
2010-08-15 18:18                       ` Dmitry A. Kazakov
replies disabled

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