From: hreba <hreba@terra.com.br>
Subject: Generic Library Units?
Date: Sun, 12 Oct 2014 11:38:16 -0300
Date: 2014-10-12T11:38:16-03:00 [thread overview]
Message-ID: <c9vi2oF65aiU1@mid.individual.net> (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
next reply other threads:[~2014-10-12 14:38 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-12 14:38 hreba [this message]
2014-10-12 15:47 ` Generic Library Units? 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
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox