* pb with child units
@ 2001-02-23 14:06 Veronique GAILDRAT
2001-02-23 14:43 ` Ted Dennison
0 siblings, 1 reply; 2+ messages in thread
From: Veronique GAILDRAT @ 2001-02-23 14:06 UTC (permalink / raw)
Hello,
I try to call a subprogram from a brother unit :
specification of the parent unit :
---------------------------------
generic
type Item is private;
with function image (t : Item) return String;
with function equals (i1, i2 : Item) return boolean;
package liste_dyn_gen_p is
type Liste is limited private;
LISTE_VIDE, LISTE_PLEINE, ERREUR_INDEX : exception;
-- d�clarations des op�rations export�es par le TDA
function toString (le : Liste) return String;
........
private
type Cellule;
type Liste is access Cellule;
type Cellule is record
value : Item;
nextV : Liste;
end record;
end liste_dyn_gen_p;
specification of the called unit :
---------------------------------
generic
package liste_dyn_gen_p.liste_simple_p is
procedure insererEnTete (le : in out Liste; i : Item);
....
end liste_dyn_gen_p.liste_simple_p;
call :
------
specification :
---------------
generic
with function "<"(i1, i2 : Item) return Boolean;
package liste_dyn_gen_p.liste_dyn_triee_p is
procedure inserer (le : in out Liste; e : Item);
end liste_dyn_gen_p.liste_dyn_triee_p;
body :
------
with liste_dyn_gen_p.liste_simple_p;
package body liste_dyn_gen_p.liste_dyn_triee_p is
procedure inserer (le : in out Liste; e : Item) is
pt : Liste := le;
pTmp : Liste;
begin
if estVide(le) or else e < premier(le) then
----> error ----> liste_dyn_gen_p.liste_simple_p.insererEnTete(le, e);
else
......
end if;
end inserer;
end liste_dyn_gen_p.liste_dyn_triee_p;
The compiling error is the next one :
invalid prefix in selected component "liste_simple_p"
but liste_simple_p is a child unit of liste_dyn_gen_p !
They are both generic, but a can use them in a child unit ??
An idea ??
Thanks
--
------------------------
Veronique Gaildrat
IRIT-UPS
email : gaildrat@irit.fr
------------------------
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: pb with child units
2001-02-23 14:06 pb with child units Veronique GAILDRAT
@ 2001-02-23 14:43 ` Ted Dennison
0 siblings, 0 replies; 2+ messages in thread
From: Ted Dennison @ 2001-02-23 14:43 UTC (permalink / raw)
In article <3A966E4D.778BE01E@irit.fr>, Veronique GAILDRAT says...
>
>I try to call a subprogram from a brother unit :
>generic
>package liste_dyn_gen_p.liste_simple_p is
> procedure insererEnTete (le : in out Liste; i : Item);
..
>with liste_dyn_gen_p.liste_simple_p;
>
>package body liste_dyn_gen_p.liste_dyn_triee_p is
> procedure inserer (le : in out Liste; e : Item) is
> begin
>----> error ----> liste_dyn_gen_p.liste_simple_p.insererEnTete(le, e);
> invalid prefix in selected component "liste_simple_p"
>
>but liste_simple_p is a child unit of liste_dyn_gen_p !
No, its not. Its a child unit of an *instantiation* of liste_dyn_gen_p. You
can't make a call to a generic, only to an *instantiation* of one. You could
make an instantiation of liste_simple_p in the body of liste_dyn_triee_p, but
that's probably not what you want because that instantiation would be different
than any others you might have outside of liste_dyn_triee_p. If you want access
to a routine in a *particular* instantiation of a generic package that is not
your package's ancestor, you will have to have it (the routine or the package)
supplied as a generic parameter to your package.
---
T.E.D. homepage - http://www.telepath.com/dennison/Ted/TED.html
home email - mailto:dennison@telepath.com
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2001-02-23 14:43 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-02-23 14:06 pb with child units Veronique GAILDRAT
2001-02-23 14:43 ` Ted Dennison
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox