comp.lang.ada
 help / color / mirror / Atom feed
From: "Mark Lundquist" <mlundquist2@attbi.com>
Subject: Mixins (was Re: Ada 200X Assertions)
Date: Thu, 06 Dec 2001 05:04:32 GMT
Date: 2001-12-06T05:04:32+00:00	[thread overview]
Message-ID: <A%CP7.1314$w85.172996@rwcrnsc54> (raw)
In-Reply-To: u0t8rui7mdo870@corp.supernews.com


"Matthew Heaney" <mheaney@on2.com> wrote in message
news:u0t8rui7mdo870@corp.supernews.com...
>
> Well, you could argue there are two mixin idioms: the one you describe
here,
> and another using access discriminants.
>

Interesting thought...

Your 2nd example is the classic "multiple views" idiom.   I had never
thought of calling it a "mixin" before (and Lutz had asked specifically
about generic mixins), but a mixin isn't a bad way of thinking of it.  My
linked-list example is a special case of this, because you normally wouldn't
override the operations of the mixed-in type -- Root_Link or whatever I
called it -- you'd just use it as is, without specialization.  In that way
it's more "mixin-like" than the general case of multiple views.

Now that you've got me thinking of this as a mixin, I may start calling it a
"composition mixin" idiom (to distinguish it from the generic mixin).

Taking the linked list example as I wrote it, it's also trivial to
"genericize" that code and make a generic mixin out of it.  That'll work
with anything that doesn't have unknown discriminants (the formal type for
the "base" type of the mixin can't be indefinite since it is a component of
the list element type).

-- mark







  reply	other threads:[~2001-12-06  5:04 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-12-04  3:53 Ada 200X Assertions Richard Riehle
2001-12-04  8:54 ` Lutz Donnerhacke
2001-12-04 17:09   ` Robert Dewar
2001-12-05 14:34     ` Lutz Donnerhacke
2001-12-04 18:43   ` Matthew Heaney
2001-12-05 15:16     ` Lutz Donnerhacke
2001-12-05 18:40       ` Matthew Heaney
2001-12-05 19:25         ` Matthew Heaney
2001-12-05 19:36         ` Lutz Donnerhacke
2001-12-05 22:00           ` Mark Lundquist
2001-12-05 22:49             ` Matthew Heaney
2001-12-06  5:04               ` Mark Lundquist [this message]
2001-12-05 19:57       ` Access discriminants (was Re: Ada 200X Assertions) Mark Lundquist
2001-12-05 21:30       ` Ada 200X Assertions Matthew Heaney
2001-12-05 21:32         ` Lutz Donnerhacke
2001-12-17  6:43       ` David Thompson
2001-12-17  8:55         ` Lutz Donnerhacke
2001-12-04 19:10 ` Randy Brukardt
2001-12-04 21:21   ` Ehud Lamm
2001-12-06  3:55     ` Richard Riehle
2001-12-06  9:41       ` Rod Chapman
2001-12-07 22:51     ` Mark Lundquist
2001-12-05  9:43 ` Volkert
replies disabled

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