comp.lang.ada
 help / color / mirror / Atom feed
* Generic Library Units?
@ 2014-10-12 14:38 hreba
  2014-10-12 15:47 ` Dmitry A. Kazakov
  0 siblings, 1 reply; 12+ messages in thread
From: hreba @ 2014-10-12 14:38 UTC (permalink / raw)


Hi,

I am writing a facility for graphical toolkits named Gui as a generic 
package and GuiGtk as an actual parameter package. As Gui grew I 
splitted it up into Gui and Gui.SimpleGad. More by trial and error than 
by strict reasoning (and with the help of John Barnes' book) I ended up 
with the following package structure:

gui.ads: parent generic package
-------
with GuiGtk;
generic
    with package TK is new GuiGk(<>);
package Gui is
    ...
end Gui;

gui-simplegad.ads: child package for Gui
-----------------
generic
package Gui.SimpleGad is
    ...
end Gui.SimpleGad

guigtk.ads: actual parameter package for Gui
----------
generic
package GuiGtk is
    ...
end GuiGtk;

mainaux.ads: auxiliary package for the main program
-----------
with Gui;
with GuiGtk;
with Gui.SimpleGad;
package MainAux is
    package Toolkit is new GuiGtk;
    package GuiTK is new Gui(Toolkit);
    ...
end MainAux;

test.adb: Main program
----
with MainAux;
procedure Test is
    ...
end Test;

Now my questions are:

1. Is this really the shortest form? (Why can't I contract the 2 lines 
under "package MainAux is" into "package GuiTK is new Gui(GuiTK)"?

2. The generic package file has to depend on a specific actual package?
If one day I decide to use, let's say Qt, then I will have to change the 
respective lines in gui.ads into
    package Toolkit is new GuiQt; ?

3. My actual package GuiGtk has grown considerably, so I want to split 
up that too into parent and child package, adding something like

guigtk-simplegad.ads:
----------------
package GuiGtk.SimpleGad is
   ...
end GuiGtk.SimpleGad;

No attempt to initialize this in MainAux or call it in Test has been 
working so far. Can somebody please give me a hint?
-- 
Frank Hrebabetzky		+55 / 48 / 3235 1106
Florianopolis, Brazil


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

end of thread, other threads:[~2014-10-17 12:57 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-10-12 14:38 Generic Library Units? hreba
2014-10-12 15:47 ` Dmitry A. Kazakov
2014-10-12 22:39   ` hreba
2014-10-13  7:45     ` Dmitry A. Kazakov
2014-10-15  0:29       ` hreba
2014-10-15  7:21         ` Dmitry A. Kazakov
2014-10-16  1:21           ` hreba
2014-10-16  7:04             ` Dmitry A. Kazakov
2014-10-16  7:54             ` Simon Wright
2014-10-17 12:46               ` hreba
2014-10-16 10:36           ` AdaMagica
2014-10-17 12:57             ` hreba

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