comp.lang.ada
 help / color / mirror / Atom feed
From: "Yannick Duchêne Hibou57" <yannick_duchene@yahoo.fr>
Subject: Re: Discriminant and type extensions
Date: Mon, 5 Oct 2009 15:15:14 -0700 (PDT)
Date: 2009-10-05T15:15:14-07:00	[thread overview]
Message-ID: <a98221d7-9579-4613-8522-3abed7b94181@s6g2000vbp.googlegroups.com> (raw)
In-Reply-To: wccljjp609m.fsf@shell01.TheWorld.com

Hi Bob,

On 5 oct, 22:42, Robert A Duff <bobd...@shell01.TheWorld.com> wrote:
> I'm not sure exactly what you mean, but you can do things like this:

An example will tell more (I've dropped any kind of genericity here) :



package P1 is

   type T_Type (Discriminant : Natural) is
      tagged
      private;

private

   type T_Type (Discriminant : Natural) is
      tagged
      null record;

end P1;



with P1;

package P2 is

   type Extension_Type is
      new P1.T_Type
      with private;

   -- Extension_Type as a discriminant, but it
   -- does not explicitly appears in this
   -- package specification.

private

   type Extension_Type is
      new P1.T_Type
      with null record;

end P2;



with P2;

procedure Usage is

   Entity :
      P2.Extension_Type
         (Discriminant => 0);

   -- Indeed, it really has a discriminant,
   -- although the package interface does
   -- not express it.

begin
   null;
end;



I was thinking in this context, it may be nice to be able to express
again the discriminant at the place Extension_Type is declared. To be
honest, it happens too I feel it would be nice to something which
would allow to recall about the underlying interface which is left
implicit. Something similar to what the keyword “ overriding ” does.
The keyword “ overriding ” recalls about what is the underlying stuff,
making things more explicit. I was thinking about something similar.

For procedures and functions, the Renames clause may do the thing
(explicitly re-introducing procedures and functions in the scope), but
for discriminants in this kind of context, I do not know a way.
Perhaps I do not know it, or perhaps this may be a candidate proposal.



  parent reply	other threads:[~2009-10-05 22:15 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-05 17:18 Discriminant and type extensions Hibou57 (Yannick Duchêne)
2009-10-05 20:42 ` Robert A Duff
2009-10-05 22:04   ` Adam Beneschan
2009-10-05 22:29     ` Yannick Duchêne Hibou57
2009-10-05 22:34       ` Yannick Duchêne Hibou57
2009-10-05 23:08         ` Adam Beneschan
2009-10-07  6:20           ` Yannick Duchêne Hibou57
2009-10-05 22:15   ` Yannick Duchêne Hibou57 [this message]
2009-10-09  6:29     ` Yannick Duchêne Hibou57
2009-10-09 15:42       ` Jean-Pierre Rosen
2009-10-07  7:21 ` Jean-Pierre Rosen
2009-10-07 15:39   ` Yannick Duchêne Hibou57
replies disabled

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