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,fed2e7871ca258cd X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-12-17 00:34:35 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!canoe.uoregon.edu!arclight.uoregon.edu!wn4feed!worldnet.att.net!204.127.198.203!attbi_feed3!attbi.com!rwcrnsc51.POSTED!not-for-mail From: "Mark Lundquist" Newsgroups: comp.lang.ada References: <87heqs5awc.fsf@deneb.enyo.de> Subject: Re: List Container Strawman 1.4 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: Mon, 17 Dec 2001 08:34:35 GMT NNTP-Posting-Host: 204.127.202.214 X-Complaints-To: abuse@attbi.com X-Trace: rwcrnsc51 1008578075 204.127.202.214 (Mon, 17 Dec 2001 08:34:35 GMT) NNTP-Posting-Date: Mon, 17 Dec 2001 08:34:35 GMT Organization: AT&T Broadband Xref: archiver1.google.com comp.lang.ada:17985 Date: 2001-12-17T08:34:35+00:00 List-Id: "Florian Weimer" wrote in message news:87heqs5awc.fsf@deneb.enyo.de... > Ted Dennison writes: > > > I have posted a strawman version 1.4 of the standard Ada List container at > > http://www.telepath.com/dennison/Ted/Containers-Lists-Unbounded.ads.html . > > > -- List <---> Unconstrained array conversions. > > type Element_Array is array (Natural range <>) of Element; > > function To (Source : Element_Array) return List; > function From (Source : List) return Element_Array; > > What about a generic version of To and From which can handle arrays > with different index types? Interesting idea, but I doubt if it would be useful enough to be justified. A list abstraction of this sort is unbounded, and since the only reason you would convert To it from one of these things with a non-integer index type would be to convert From the list back to it again, you're not going to be adding or deleting elements... using a list this way (e.g. to find or sort) is quite roundabout, it would be much better to have a Fixed variant of the sequence abstraction. 'To' is probably much more useful than 'From', in any case (you can use an aggregate notation to initialize your list). > > -- Passive iterator. Operation will be applied on each element on the list > -- Opertion can terminate this process early by setting Quit to True. > > generic > with procedure Operation (Target : in out Element; Quit : out Boolean); > procedure Passive_Iterator (Target : in out List); > > > I'd like to suggest to make Quit mode "in out", with a default of > False. There are no defaults for anything other than an "in" mode parameter. > > -- Sorting sub-package. > -- To sort in increasing order, use the ">" routine for the Reverse_Order > -- parameter. To sort in decreasing order, substitute your "<" routine for > -- the Reverse_Order parameter. :-) > > I think the Reverse_Order predicate should be named differently, so > that it's clear from its name that it's a predicate. "Reverse_Order" > could also mean "Reverse the order of the elments.", not just "Are > these elements in reversed order?". I must say I don't care much for these attempts to avoid using a relational operator for the predicate ("Swap", "Reverse_Order"). They are a case of the cure being worse than the disease. Besides being obtuse and bletcherous, they lack the notational convenience provided by a relational operator with a box (<>) default. -- mark