From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: Ada 2005+ interface example
Date: Sun, 27 Jan 2013 17:54:38 +0100
Date: 2013-01-27T17:54:38+01:00 [thread overview]
Message-ID: <fpwdcz6f1wcp$.9adzbodl3jbk.dlg@40tude.net> (raw)
In-Reply-To: d1374e42-b8a1-476f-a7e1-18d1371643cd@googlegroups.com
On Sun, 27 Jan 2013 06:08:31 -0800 (PST), gautier_niouzes@hotmail.com
wrote:
> Does someone have an example of Ada 2005 interface type ?
You might find interfaces actively used in the AICWL, e.g.
http://www.dmitry-kazakov.de/ada/aicwl.htm#2.5
A layer of the widget usually implements several interfaces. For example:
type Elliptic_Scale_Layer (<>) is
new Abstract_Bordered_Layer
and Scalable_Layer
and Widened_Layer with private;
> Just to see how it works in practice.
It works just fine, except the cases when full MI is required. Then it
becomes quite messy because the only way to provide implementations is
through generics.
Another case for interfaces in Ada 2005 is smart pointers. I don't know how
well the newly introduced by Ada 2012 dereferencing works. But in Ada 2005
you would use an interface to describe both the target type and the
controlled pointer.
type Thing is limited interface;
... -- operations on thing
type Handle is ... and Thing ...;
... -- implements operations by delegation to the target
private
type Implementation is ... and Thing ...;
... -- implements operations
--
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de
next prev parent reply other threads:[~2013-01-27 16:54 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-27 14:08 Ada 2005+ interface example gautier_niouzes
2013-01-27 16:54 ` Dmitry A. Kazakov [this message]
2013-01-28 17:27 ` Gautier write-only
2013-01-28 22:02 ` John B. Matthews
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox