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.4 required=5.0 tests=AC_FROM_MANY_DOTS,BAYES_00, XPRIO autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,20b3b2fc48674108,start X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-07-03 08:40:28 PST Path: archiver1.google.com!newsfeed.google.com!sn-xit-02!supernews.com!newsfeed.direct.ca!look.ca!btnet-peer0!btnet-peer1!btnet!isdnet!psinet-france!psiuk-f4!psiuk-p4!uknet!psiuk-n!news.pace.co.uk!nh.pace.co.uk!not-for-mail From: "Marin David Condic" Newsgroups: comp.lang.ada Subject: Preferred method for bringing in operators Date: Tue, 3 Jul 2001 11:16:43 -0400 Organization: Posted on a server owned by Pace Micro Technology plc Message-ID: <9hsnkr$90q$1@nh.pace.co.uk> NNTP-Posting-Host: 136.170.200.133 X-Trace: nh.pace.co.uk 994173403 9242 136.170.200.133 (3 Jul 2001 15:16:43 GMT) X-Complaints-To: newsmaster@pace.co.uk NNTP-Posting-Date: 3 Jul 2001 15:16:43 GMT X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4522.1200 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200 Xref: archiver1.google.com comp.lang.ada:9382 Date: 2001-07-03T15:16:43+00:00 List-Id: This is a question about style and preferences, rather than something purely technical. I just want to know what people prefer and if there are any reasons to consider one style superior to another... Suppose you build a class to represent a container of some objects. The objects are just stored and retrieved from the container in no particular order. Now you want to derive a child class from the container only in this case you want to store and retrieve the objects in sorted order. That means you have to somehow extend the class to bring in one or more comparison operations for the object being stored. A variety of solutions exist: 1) Make the child generic and bring in the comparison functions needed in the generic parameter list. Some version of 'with function "<" (Left..." The user then needs to create an instance of the child providing the operation as a parameter. 2) Declare in the child package an abstract function to operate on the stored objects and provide comparisons. The user then needs to create one more derivation from the child package to provide the abstract operation. 3) Extend the class for the stored objects to have a "Ordered Object" that has abstract functions for comparisons. Allow only objects of this class to be put in the list. The user must extend the object class to provide the functions. (May have problems with compatibility with the parent class - type conflicts, etc.) 4) Do something to declare an access type to the function and expect the user to provide the access value as part of the creation of the list. (Don't really like this answer much. Where do the declarations go and how would they look?) There may be other ways of doing the feline-epidermal-removal, but these are the ones I can think of. I'm curious about what others think would be the best idiom for doing this? MDC -- Marin David Condic Senior Software Engineer Pace Micro Technology Americas www.pacemicro.com Enabling the digital revolution e-Mail: marin.condic@pacemicro.com Web: http://www.mcondic.com/