From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=unavailable autolearn_force=no version=3.4.4 Path: border1.nntp.dca1.giganews.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!usenet.blueworldhosting.com!feeder01.blueworldhosting.com!feeder.erje.net!eu.feeder.erje.net!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: hreba Newsgroups: comp.lang.ada Subject: Generic Library Units? Date: Sun, 12 Oct 2014 11:38:16 -0300 Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Trace: individual.net zOmozGN+MPz9xvGXRzKWownLL/ZMmL6MB2eqYNVwTHpydsGHkP Cancel-Lock: sha1:LqKHPYbK0enUSGRu9Dim6UsIpJ8= User-Agent: Mozilla/5.0 (X11; Linux i686; rv:31.0) Gecko/20100101 Thunderbird/31.0 Xref: number.nntp.giganews.com comp.lang.ada:189693 Date: 2014-10-12T11:38:16-03:00 List-Id: 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