From: hreba <hreba@terra.com.br>
Subject: Re: Generic Library Units?
Date: Wed, 15 Oct 2014 22:21:30 -0300
Date: 2014-10-15T22:21:30-03:00 [thread overview]
Message-ID: <ca8kssFhl6cU1@mid.individual.net> (raw)
In-Reply-To: <1e3dumb4ql0xb$.1reo7fz5y3vyl.dlg@40tude.net>
On 10/15/2014 04:21 AM, Dmitry A. Kazakov wrote:
> 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".
>
Basically I only need type and subprogram parameters for my generic
package Gui (and Gui.SimpleGad) package.
As I have dozens of subprogram parameters, I packed them (together with
the types) into a package parameter GuiGtk and it worked. It didn't work
anymore when I outsourced part of GuiGtk into GuiGtk.SimpleGad.
From what you say I understand that there is no cure, so I will stick
to a GuiGtk without a child package.
Thanks for the hints.
--
Frank Hrebabetzky +55 / 48 / 3235 1106
Florianopolis, Brazil
next prev parent reply other threads:[~2014-10-16 1:21 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
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