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 14:00:14 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!howland.erols.net!news-out.worldnet.att.net.MISMATCH!wn3feed!worldnet.att.net!204.127.198.204!attbi_feed4!attbi.com!rwcrnsc54.POSTED!not-for-mail From: "Mark Lundquist" Newsgroups: comp.lang.ada References: <3C0C48BE.3B20F04E@adaworks.com> Subject: 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: Wed, 05 Dec 2001 22:00:13 GMT NNTP-Posting-Host: 204.127.202.214 X-Complaints-To: abuse@attbi.com X-Trace: rwcrnsc54 1007589613 204.127.202.214 (Wed, 05 Dec 2001 22:00:13 GMT) NNTP-Posting-Date: Wed, 05 Dec 2001 22:00:13 GMT Organization: AT&T Broadband Xref: archiver1.google.com comp.lang.ada:17480 Date: 2001-12-05T22:00:13+00:00 List-Id: "Lutz Donnerhacke" wrote in message news:slrna0stp1.pjb.lutz@belenus.iks-jena.de... > * Matthew Heaney wrote: > >"Lutz Donnerhacke" wrote in message > >> Typical example 2: A head node of a linked list contains a next pointer > >> which should be handled exactly as the next pointer of the real > >> list nodes, but no payload at all. > > > >In the code below, I do this by making the List_Type a private derivation of > >a Node_Type. Which means a List_Type, containing only the head pointer, can > >be used exactly like Node_Type. > > > type Node_Type is abstract tagged private; > > type List_Type is new Node_Type with private; > > That's not a generic mixin. > > My job is: > task type Bla is ...; > type Blas is array (Positive range <>) of Bla; > type Foo (len : Natural) is abstract record > t : Bla (Positive'First .. len); > end record; > procedure Process (a : Foo) is abstract; > > package Bla_List is new List (Bla); > package Bla_List2 is new List (Bla); Well, what you have there is not really a mixin, either. That's just a "plain old" generic list :-) (POGL). The mixin idiom takes a generic formal tagged type, and exports an extension of that type with additional properties/behaviors. The POGL gives you an "externally-linked"/"containing"/"value-oriented" list, where the collection owns the items. The mixin gives you an "internally-linked"/"by reference"/"object-oriented" list, where the client owns the items. Now... I'll bet you can take the example I wrote, or the one Matt wrote, and figure out how to make either a generic mixin, or a plain old generic list, with a header using the access discriminant technique. Your example is of a list of tasks. Since these are limited, you have two ways to go: 1) Use a POGL (as shown in your example). That POGL will have to have the formal item type as limited; such a POGL does not do any assignments to the items, even though it owns and creates them. Instead, it returns pointers to the items. 2) Use a mixin on a tagged container type, like this: type Bla_Container is tagged record Contents : Bla; end record; package Bla_Lists is new Lists_Mixin (Base => Bla); subtype Listable_Bla is Bla_Lists.Item_Type; -- whatever Best, Mark