Newbie Ada

From: Axel Druesnes (druesnes.remove_at_noos.fr)
Date: 04/30/04


Date: Fri, 30 Apr 2004 14:17:30 +0200

Hi there,

  i am currently writing a generic package. Despite being really generic
one (at least) particular type need a special handling in two functions.
I am therefore wondering how i can either detect the type... So far i
thought of calling an overloaded function with a variable of the generic
type as a parameter which would return a special identifier for this
type but Ada doesn't allow me to call the said function as it consider
the generic type to be a type of itself instead of a placeholder for the
real type before the generic package is specialized.

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 )

ex:

function Type_Id ( Value : in Boolean ) return E_Type_Id;
function Type_Id ( Value : in Integer ) return E_Type_Id;

-- Inside the body
procedure I_Need_The_Type ( Value : Generic_Type )
...
Type_Identifier := Type_Id ( Value ); -- i wish it worked here

Axel Druesnes



Relevant Pages

  • Re: Newbie Ada
    ... > i am currently writing a generic package. ... > one particular type need a special handling in two functions. ... Well, I don't really know Ada, but I think the Ada approach would be to ...
    (comp.lang.ada)
  • Re: Newbie Ada
    ... Axel Druesnes writes: ... > i am currently writing a generic package. ... > generic one particular type need a special handling in two ...
    (comp.lang.ada)
  • Re: Newbie Ada
    ... On 2004-04-30, Axel Druesnes wrote: ... > i am currently writing a generic package. ... Then they don't belong in a generic package. ... http://www.pvv.org/~randhol/ "Violence is the last refuge of the incompetent" ...
    (comp.lang.ada)
  • Type detection
    ... > one particular type need a special handling in two functions. ... since the type is known when you instantiate the ... highly generic package and call the common subprograms in it. ...
    (comp.lang.ada)