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=0.6 required=5.0 tests=BAYES_00,TO_NO_BRKTS_FROM_MSSP autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,e382b50ddc696050 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-12-05 11:14:48 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!hub1.nntpserver.com!news-out.spamkiller.net!propagator-la!news-in-la.newsfeeds.com!newsranger.com!www.newsranger.com!not-for-mail Newsgroups: comp.lang.ada From: Ted Dennison References: <3C0DB9D0.7184868A@acm.org> Subject: Re: List Strawman JC01 Message-ID: X-Abuse-Info: When contacting newsranger.com regarding abuse please X-Abuse-Info: forward the entire news article including headers or X-Abuse-Info: else we will not be able to process your request X-Complaints-To: abuse@newsranger.com NNTP-Posting-Date: Wed, 05 Dec 2001 14:14:32 EST Organization: http://www.newsranger.com Date: Wed, 05 Dec 2001 19:14:32 GMT Xref: archiver1.google.com comp.lang.ada:17465 Date: 2001-12-05T19:14:32+00:00 List-Id: In article <3C0DB9D0.7184868A@acm.org>, Jeffrey Carter says... > >some alternative naming conventions for consideration. > type List_Handle is private; -- Initial value: Empty > -- [Keep the name List for parameters] I'm not a fan of the style where one adds a meaningless word like "Type" or "Handle" to the end of identifiers to save name space for other uses. Types should be named describing the general concept of what they represent, and objects and parameters should be given names describing their explicit role in the system. > type Location is private; -- A position within a list; > -- Degree of safety TBD > -- Initial value: invalid > -- [Keep the shorter name Position for parameters] I have no concerns with this either way. If people prefer this scheme to the newer "Iterator", I'd have no objections to using it. > -- Time: O(N) I'd agree that this needs to be documented for the routines. However, it might be better to put this information in a matrix in the parent pacakge so that users can judge the various container package's performances against each other when deciding which one to use. > -- Postcondition: Is_Empty (List) This information should also be there, when there are important postconditions. However, I prefer using English sentences to document this rather than some kind of formal jargon. The difference in typing isn't even all that large between "Postcondition:" and "Upon completion ". :-) > -- [Apparently unneeded List_Handle parameters are supplied > -- to some operations in case they're needed for safety.] If we don't go to completely "safe" iterators, perhaps. With completely safe iterators, its pretty pointless (all it does is give the user another way to screw up the call). The current version of the Strawman uses the safe approach, so the List type need not be supplied after the iterator is constructed. > Storage_Exhausted : exception; Why is this considered superior to STORAGE_ERROR? Do you have plans to do something here other than just handle STORAGE_ERROR and raise Storage_Exhausted? > generic -- Sort > with function "<" (Left : Element; Right : Element) I really don't like this name, as it gets quite confusing what is going on when "<" is not used for the actual. (In fact, without the comment, I'd have little clue what is going on either way). I'd rather see the function named after either what it wants done or what condition exists relative to general sorting when TRUE is returned. > -- Sorts List into ascending order as defined by "<" Perfect example here. What precisely does "ascending order as defined by "<"" mean? I *still* don't know if supplying ">" will sort in ascending or decending order when iterated in the direction I like to iterate, based on the routine name and this comment. For a code reader its even worse, because all they will see is: Foo_Sort is new Sort ("<" => ">"); Their reaction is liable to be roughly "WTF?" On the other hand, if they see Foo_Sort is new Sort (Swap_Items => ">"); ..then at least its clear to the reader that the sort will consider things out of order when the first item is greater than the second. We still have a bit of a problem here, as "First" and "Second" (or "Left" and "Right") aren't very well defined in this context. Is the "Front" of the list on the left or the right? Does "Sort" sort towards the front or the back? Hmmm....perhaps the best way to solve that issue would be to provide a direction type (non-generic) paramter to Sort as well. --- T.E.D. homepage - http://www.telepath.com/dennison/Ted/TED.html No trees were killed in the sending of this message. However a large number of electrons were terribly inconvenienced.