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=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC,WEIRD_PORT autolearn=no autolearn_force=no version=3.4.4 Path: border2.nntp.dca1.giganews.com!border1.nntp.dca1.giganews.com!nntp.giganews.com!usenet.blueworldhosting.com!feeder01.blueworldhosting.com!feeder.erje.net!eu.feeder.erje.net!eternal-september.org!feeder.eternal-september.org!aioe.org!.POSTED!not-for-mail From: "Dmitry A. Kazakov" Newsgroups: comp.lang.ada Subject: Re: Generic Library Units? Date: Wed, 15 Oct 2014 09:21:06 +0200 Organization: cbb software GmbH Message-ID: <1e3dumb4ql0xb$.1reo7fz5y3vyl.dlg@40tude.net> References: <10ir7anot1ujj$.kcl1b5ynppz8.dlg@40tude.net> Reply-To: mailbox@dmitry-kazakov.de NNTP-Posting-Host: ZB2Fb2q1fa4xpMpNKFqV6Q.user.speranza.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Complaints-To: abuse@aioe.org User-Agent: 40tude_Dialog/2.0.15.1 X-Notice: Filtered by postfilter v. 0.8.2 Xref: number.nntp.giganews.com comp.lang.ada:189802 Date: 2014-10-15T09:21:06+02:00 List-Id: On Tue, 14 Oct 2014 21:29:16 -0300, hreba wrote: > On 10/13/2014 04:45 AM, Dmitry A. Kazakov wrote: >> >> with Gui; >> with GuiGtk.SimpleGad; >> with Gui.SimpleGad; >> package MainAux is >> package Toolkit is new GuiGtk; >> package SimpleGad is new Toolkit.SimpleGad; >> package GuiTK is new Gui (Toolkit, SimpleGad); >> end MainAux; >> > Ok, did that too, and the error message disappeared. > > Now in the package body of Gui.SimpleGad I have > > function Get (gad: BoolGadget) return boolean is > begin > return TKSG.GetBool (gad.widget.all); > end Get; > > and get the error message > > gui-simplegad.adb:78:39: expected type "GuiGtk.GadWidgets" defined at > guigtk.ads:38 > gui-simplegad.adb:78:39: found type "TK.GadWidgets" defined at > guigtk.ads:38, instance at gui.ads:10 > > So the compiler isn't aware that GuiGtk is the actual value to the > formal package TK. How do I tell him? You can't. GuiGtk is a generic package. It cannot be actual of anything. Actuals are *real* things. E.g. an instance of a generic package can be actual of a formal package. > ( The Gui package header is > > generic > with package TK is new GuiGtk(<>); -- this is gui.ads:10 > with package TKSG is new GuiGtk.SimpleGad; > package Gui is > ... > ) Which has nothing to do with GuiGtk and GuiGtk.SimpleGad. Generic packages know nothing about any instances of. That is the basic idea of being "generic". -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de