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,WEIRD_PORT autolearn=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!mx02.eternal-september.org!news.eternal-september.org!feeder.eternal-september.org!news.swapon.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: hreba Newsgroups: comp.lang.ada Subject: Re: Generic Library Units? Date: Sun, 12 Oct 2014 19:39:49 -0300 Message-ID: References: <10ir7anot1ujj$.kcl1b5ynppz8.dlg@40tude.net> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-Trace: individual.net 5x81P5aTV95qjwVx8MkGHAKigSX1OKYZytKwU0Od7jhTWxwmGn Cancel-Lock: sha1:Qyol1BaEJ3Un+yka0h440Dol05g= User-Agent: Mozilla/5.0 (X11; Linux i686; rv:31.0) Gecko/20100101 Thunderbird/31.0 In-Reply-To: <10ir7anot1ujj$.kcl1b5ynppz8.dlg@40tude.net> Xref: news.eternal-september.org comp.lang.ada:22403 Date: 2014-10-12T19:39:49-03:00 List-Id: On 10/12/2014 12:47 PM, Dmitry A. Kazakov wrote: > On Sun, 12 Oct 2014 11:38:16 -0300, hreba wrote: > > A child of a generic package must be generic. I.e. you should declare it > this way: > > generic > package GuiGtk.SimpleGad is > Did that. And I added to Gui.ads the line with package TKSG is new GuiGtk.SimpleGad; Now the line in mainaux.ads: package GuiTK is new Gui(Toolkit); which was correct before, is accused: mainaux.ads:10:04: missing actual "TKSG" mainaux.ads:10:04: in instantiation of "Gui" declared at gui.ads:13 Adding package ToolkitSG is new GuiGtk.SimpleGad; before that line gets me mainaux.ads:9:29: invalid prefix in selected component "GuiGtk" Replacing it with package ToolkitSG is new Toolkit.SimpleGad; turns the error message into mainaux.ads:9:36: generic child unit "SimpleGad" is not visible So how do I instantiate that? > And you will have to instantiate it somewhere. > > Generic packages are not suitable for abstraction GUI engines as complex as > GTK or Qt. If you really want to use both GTK and Qt as the back-end, you > should carefully design a set of abstract tagged types in several packages. > GTK and Qt versions will derive from theses types. > I don't want to mix different toolkits. I want to have the same API in the case I switch to another one later. -- Frank Hrebabetzky +55 / 48 / 3235 1106 Florianopolis, Brazil