comp.lang.ada
 help / color / mirror / Atom feed
From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: Generic Library Units?
Date: Sun, 12 Oct 2014 17:47:16 +0200
Date: 2014-10-12T17:47:16+02:00	[thread overview]
Message-ID: <10ir7anot1ujj$.kcl1b5ynppz8.dlg@40tude.net> (raw)
In-Reply-To: c9vi2oF65aiU1@mid.individual.net

On Sun, 12 Oct 2014 11:38:16 -0300, hreba wrote:

[...]
> 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)"?

Yes. Each generic instance must have a name and be explicitly instantiated.

> 2. The generic package file has to depend on a specific actual package?

If it has a formal package parameter then each its instance depends 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; ?

That will not work. It should be an instance of GuiGk if you want to pass
it as the parameter TK.

> 3. My actual package GuiGtk has grown considerably, so I want to split 
> up that too into parent and child package, adding something like

A child of a generic package must be generic. I.e. you should declare it
this way:

generic
package GuiGtk.SimpleGad is

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.

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de


  reply	other threads:[~2014-10-12 15:47 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 [this message]
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