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,7ee10ec601726fbf X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-11-01 09:52:56 PST Newsgroups: comp.lang.ada Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!cpk-news-hub1.bbnplanet.com!news.gtei.net!newsfeed1.cidera.com!Cidera!portc03.blue.aol.com!uunet!dca.uu.net!ash.uu.net!xyzzy!nntp From: Jeffrey Carter Subject: Re: why not X-Nntp-Posting-Host: e246420.msc.az.boeing.com Content-Type: text/plain; charset=us-ascii Message-ID: <3BE18A23.BC921FA9@boeing.com> Sender: nntp@news.boeing.com (Boeing NNTP News Access) Content-Transfer-Encoding: 7bit Organization: The Boeing Company X-Accept-Language: en References: <3BC5D730.DA950CC7@boeing.com> <9q4pa7$1ad$1@nh.pace.co.uk> <3BC6ACC8.23EF21BC@free.fr> <3BC71F54.1FFE78FA@boeing.com> <1KGx7.26476$ev2.35117@www.newsranger.com> <3BC7AD82.2A0CCCD4@acm.org> <9qhiqr$af0$1@nh.pace.co.uk> <1nDC7.180$6S7.92255364@newssvr11.news.prodigy.com> <9rjsak$bp3$1@nh.pace.co.uk> Marin David Condic wrote: > > I agree. Sorting needs to be inside of the data structure - not done > externally. However, it isn't clear if the container should always be > sortable or not. For example, if it is implemented as a generic and the > parameter is private, you don't have the operations one would need on an > ordinal type to do the sorting. (Too bad Ada didn't provide generic > parameters of "Ordinal" and "Scalar" so you could presume the existence of > comparison or arithmetic operators. Hmmmmm.....) If you bring in "<" and "=" > as function parameters, you can then insert/sort in ascending/descending > order as required - but now you impose that requirement on all things that > might be stored in the container. What if the items being stored are not > ordinal? Or you have no need of sorting? This is hardly an issue. Look, for example, at PragmARC.List_Unbounded_Unprotected. It imports a limited private formal and an Assign procedure, and provides a generic Sort procedure that imports "<". If you cannot define a meaningful "<" for your Element type, or do not need sorting, you don't instantiate the Sort procedure. Note that "=" is not needed for sorting. -- Jeffrey Carter