comp.lang.ada
 help / color / mirror / Atom feed
* generic package dilemma
@ 1999-11-17  0:00 Riyaz Mansoor
  1999-11-17  0:00 ` Matthew Heaney
  0 siblings, 1 reply; 44+ messages in thread
From: Riyaz Mansoor @ 1999-11-17  0:00 UTC (permalink / raw)




hi

hi i'm working on a  problem which requires me to use many packages. the
design i've made is like this. i've not given the details of the packages or
data structures as i think the problem is not in them but rather in the way
i'm initialising.

==============================================
the main procedure initialises "gen_pack1" and "gen_pack4" as below

-- main procedure
with gen_pack1;
with gen_pack4;
procedure main is
    package pack1 is new gen_pack1; use pack1;
    package pack4 is new gen_pack4; use pack4;
    blah blha
begin
    blah
end main;

==============================================
"gen_pack1" initialises "gen_pack2" and "gen_pack3" as below.

-- gen_pack1
with gen_pack2;
with gen_pack3;
package gen_pack1 is
    package pack2 is new gen_pack2; use pack2;
    package pack3 is new gen_pack3; use pack3;
    blah blah
end gen_pack1;


the above works fine (as i see it). main instantiates pack1, and then pack1
instantiates pack2 & pack3. the main does recieve a valid variable from
pack1 (and therfore pack2 and pack3).

heres the problem. this variable is now passed int pack4 from the main.
pack4 NEEDS functions and procedures in pack2 and pack3 to manipulate the
variable. at the moment i've set pack4 as below and it does NOT work

-- gen_pack4
with gen_pack2;
with gen_pack3;
package gen_pack4 is
    -- create copy
    package pack21 is new gen_pack2; use pack21
    package pack31 is new gen_pack3; use pack31;
    blah blah
end gen_pack4;

it gives a type error! says that expected type is pack2.(type) but found
type is pack21.(type). same for the other package.
i even tried using the same names (stupid maybe) but to no avail.
how can i get out of this? or is this a major design flaw?

NOTE: when i remove the genrics all  packages work fine and give the correct
output.


riyaz


----------------------------------------------------

AND THEN THEIR WAS LIGHT






^ permalink raw reply	[flat|nested] 44+ messages in thread

end of thread, other threads:[~1999-12-06  0:00 UTC | newest]

Thread overview: 44+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-11-17  0:00 generic package dilemma Riyaz Mansoor
1999-11-17  0:00 ` Matthew Heaney
1999-11-17  0:00   ` Mats Weber
1999-11-17  0:00     ` Matthew Heaney
1999-11-18  0:00       ` Mats Weber
1999-11-18  0:00         ` Matthew Heaney
1999-11-19  0:00           ` Mats Weber
1999-11-19  0:00             ` Vladimir Olensky
1999-11-19  0:00             ` Matthew Heaney
1999-11-19  0:00               ` Mats Weber
1999-11-22  0:00                 ` Robert Dewar
1999-11-22  0:00                   ` Mats Weber
1999-11-22  0:00                     ` Robert A Duff
1999-11-23  0:00                       ` Robert Dewar
1999-12-01  0:00                       ` Robert I. Eachus
1999-12-01  0:00                         ` Robert I. Eachus
1999-11-22  0:00                   ` Robert A Duff
1999-11-23  0:00                     ` Robert Dewar
1999-11-29  0:00                       ` Robert A Duff
1999-12-01  0:00                         ` Robert Dewar
1999-12-01  0:00                       ` Robert A Duff
1999-12-02  0:00                         ` Mats Weber
1999-12-03  0:00                           ` Robert Dewar
1999-12-03  0:00                             ` Robert A Duff
1999-12-06  0:00                               ` Robert Dewar
1999-12-03  0:00                             ` Ted Dennison
1999-12-04  0:00                               ` Robert Dewar
1999-11-22  0:00                   ` Larry Kilgallen
1999-11-23  0:00                     ` Robert Dewar
1999-11-22  0:00                   ` Mats Weber
1999-11-22  0:00                     ` Bryce Bardin
1999-11-23  0:00                     ` Robert Dewar
1999-11-19  0:00               ` Robert Dewar
1999-11-19  0:00                 ` Matthew Heaney
1999-11-20  0:00                   ` Mats Weber
1999-11-19  0:00                 ` Robert I. Eachus
1999-11-22  0:00                   ` Robert Dewar
1999-11-22  0:00                     ` Matthew Heaney
1999-11-18  0:00       ` Robert A Duff
1999-11-18  0:00         ` Matthew Heaney
1999-11-19  0:00       ` Robert Dewar
1999-11-18  0:00   ` Riyaz Mansoor
1999-11-19  0:00     ` Robert Dewar
1999-11-19  0:00   ` Robert Dewar

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