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 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,616091a85ff150f1 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-12-05 21:04:32 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!arclight.uoregon.edu!wn4feed!worldnet.att.net!204.127.198.203!attbi_feed3!attbi.com!rwcrnsc54.POSTED!not-for-mail From: "Mark Lundquist" Newsgroups: comp.lang.ada References: <3C0C48BE.3B20F04E@adaworks.com> Subject: Mixins (was Re: Ada 200X Assertions) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4133.2400 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400 Message-ID: Date: Thu, 06 Dec 2001 05:04:32 GMT NNTP-Posting-Host: 204.127.202.214 X-Complaints-To: abuse@attbi.com X-Trace: rwcrnsc54 1007615072 204.127.202.214 (Thu, 06 Dec 2001 05:04:32 GMT) NNTP-Posting-Date: Thu, 06 Dec 2001 05:04:32 GMT Organization: AT&T Broadband Xref: archiver1.google.com comp.lang.ada:17498 Date: 2001-12-06T05:04:32+00:00 List-Id: "Matthew Heaney" 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