comp.lang.ada
 help / color / mirror / Atom feed
From: Lutz Donnerhacke <lutz@iks-jena.de>
Subject: Re: Newbie Ada
Date: Fri, 30 Apr 2004 14:49:28 +0000 (UTC)
Date: 2004-04-30T14:49:28+00:00	[thread overview]
Message-ID: <slrnc94prn.oo.lutz@taranis.iks-jena.de> (raw)
In-Reply-To: 409243DA.2000906@noos.fr

* Axel Druesnes wrote:
> Any suggestion about how i could call a function with the generic type as
> a parameter without creating errors ? Other ways to detect types is
> welcolme ( i can't use an enumeration value in place of a type in this
> case )
>
> function Type_Id ( Value : in Boolean ) return E_Type_Id;
> function Type_Id ( Value : in Integer ) return E_Type_Id;

You don't need this.

> -- Inside the body
> procedure I_Need_The_Type ( Value : Generic_Type )

First variant: You like to declare and define this function internally.

generic
   type Generic_Type(<>) is limited private;
package XXX is
   procedure I_Need_The_Type (Value : Generic_Type);
end XXX;

package body XXX is
   procedure I_Need_The_Type (Value : Generic_Type) is
   begin
      null;
   end I_Need_The_Type;
end XXX;

Second variant: You need to call an external function of this type.

generic
   type Generic_Type(<>) is limited private;
   with procedure I_Need_The_Type (Value : Generic_Type);
package XXX is
   procedure Doit (x : Generic_Type);
end XXX;

package body XXX is
   procedure Doit (x : Generic_Type) is
   begin
      I_Need_The_Type(x);
   end Doit;
end XXX;

Have fun.



  parent reply	other threads:[~2004-04-30 14:49 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-04-30 12:17 Newbie Ada Axel Druesnes
2004-04-30 12:22 ` Preben Randhol
2004-04-30 13:20 ` Hyman Rosen
2004-04-30 13:54 ` Type detection Björn Persson
2004-04-30 15:04   ` Marius Amado Alves
2004-05-01  0:28   ` Robert I. Eachus
2004-05-01  5:01     ` James Rogers
2004-05-01  7:12       ` Robert I. Eachus
2004-05-01 12:43       ` Björn Persson
2004-05-01 12:42     ` Björn Persson
2004-04-30 14:49 ` Lutz Donnerhacke [this message]
2004-05-02 13:33 ` Newbie Ada Stephen Leake
replies disabled

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