comp.lang.ada
 help / color / mirror / Atom feed
* Sugestion to Multiple Inheritance
@ 2002-01-11 10:20 Lutz Donnerhacke
  2002-01-11 17:21 ` Stephen Leake
                   ` (4 more replies)
  0 siblings, 5 replies; 28+ messages in thread
From: Lutz Donnerhacke @ 2002-01-11 10:20 UTC (permalink / raw)


I'm looking for a design glue to build something like this:

 I have an several (at least two) interfaces with must be implemented
 by the end user (compiler should require implementation). All of them
 build a free(!) depedency tree. The simplest one is:
    
     A -> B     B is an extended A and C is an extended A.
     |    |     D combines both extensions (requiring both).
     v    v
     C -> D
 
 There are (generic) packages requiring special interfaces.

I'd like to use abstract types and class wide programming, but this can't be
done in Ada naturally.

The rationale suggests three solutions in chapter "4.6  Multiple Inheritance":
  - Adding B as a component extension of C to form D.
    This is not possible for abstract types.
  - Mixin Inheritance
    The extensions for B can be implemented as a mixin, but this results in
    diffenent instantions for B and D. So D can not be converted to B.
  - Adding B with access to D as a component extension of C to form D.
    This is not possible for abstract types.

Combining those: 
  - Adding B as a access constraint of C to form D.
    Its possible to define "type D (b_view : access B) is new C;"
    But this requires double instantiation of the complex data structure of A
    and double maintainces of this data structure. So it's error prone.
    It's even not possible to drop D into a B'Class argument, requiring
    multiple implementations of the same algorithm.

In order to overcome the multiple implementations constraint, it's possible
to generalize more and building the using package generic in the A -> C
abstract type and the used mixin for the B functionality.

Better solutions?



^ permalink raw reply	[flat|nested] 28+ messages in thread

end of thread, other threads:[~2002-01-28 16:23 UTC | newest]

Thread overview: 28+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-01-11 10:20 Sugestion to Multiple Inheritance Lutz Donnerhacke
2002-01-11 17:21 ` Stephen Leake
2002-01-11 17:53   ` Lutz Donnerhacke
2002-01-11 19:57     ` Stephen Leake
2002-01-17  8:28       ` Lutz Donnerhacke
2002-01-17 14:31         ` Stephen Leake
2002-01-17 14:54           ` Lutz Donnerhacke
2002-01-17 20:52             ` Jim Rogers
2002-01-11 18:07 ` Mark Lundquist
2002-01-11 18:14 ` Richard Riehle
2002-01-11 20:56   ` Hyman Rosen
2002-01-12  7:35     ` Richard Riehle
2002-01-13  6:37       ` Hyman Rosen
2002-01-14 13:58         ` John English
2002-01-14 16:27           ` Ole-Hjalmar Kristensen
2002-01-12  2:09   ` Will
2002-01-11 22:04 ` Matthew Heaney
2002-01-15 15:32   ` Hyman Rosen
2002-01-15 16:03     ` Lutz Donnerhacke
2002-01-18 19:03       ` Matthew Heaney
2002-01-21 11:23         ` Lutz Donnerhacke
2002-01-21 16:43           ` Brian Rogoff
2002-01-21 17:00             ` Lutz Donnerhacke
2002-01-22 16:55               ` Brian Rogoff
2002-01-23  8:58                 ` Dmitry A. Kazakov
2002-01-25  0:09                   ` Brian Rogoff
2002-01-28 16:23                     ` Dmitry A. Kazakov
2002-01-12  0:28 ` Nick Roberts

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox