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,b74ec64483660e21 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-07-24 08:31:07 PST Path: archiver1.google.com!newsfeed.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!feeder.qis.net!washdc3-snh1.gtei.net!chcgil2-snf1.gtei.net!news.gtei.net!news.huji.ac.il!not-for-mail From: "Ehud Lamm" Newsgroups: comp.lang.ada Subject: Re: When to use 'Class in a parameter list Date: Tue, 24 Jul 2001 18:29:08 +0300 Organization: The Hebrew University of Jerusalem Message-ID: <9jk49h$ktk$1@news.huji.ac.il> References: <9ji1b3$4pi$1@nh.pace.co.uk> <3B5CDBCA.5810@li.net> <9jjr39$o3l$1@nh.pace.co.uk> <3B5D8819.E9D8AD4E@mediaone.net> NNTP-Posting-Host: di4-42.dialin.huji.ac.il X-Trace: news.huji.ac.il 995988594 21428 132.64.14.42 (24 Jul 2001 15:29:54 GMT) X-Complaints-To: abuse@news.huji.ac.il NNTP-Posting-Date: Tue, 24 Jul 2001 15:29:54 +0000 (UTC) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.00.2014.211 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2014.211 Xref: archiver1.google.com comp.lang.ada:10523 Date: 2001-07-24T18:29:08+03:00 List-Id: Ed Falis wrote in message news:3B5D8819.E9D8AD4E@mediaone.net... > There are two situations I find useful for using classwide parameters. > > The first is when I want to force that the implementation of a routine > will not be overridden by derived type. Indedd. I failed to mention this reason, since it seemed like this is what Marin focused on, where as I find the second reason of greater design importance. But it is useful to keep this in mind (as well as trick for making routines non-primitive, like declaring them in a child unit). > > The second is for implementing a "template pattern", where some overall > processing is applied regardless of the specific type of the parameter, > and dispatching is used within the routine to handle variation among > specific types. For instance, when traversing a tree, certain steps are > applied to all nodes, whether internal or leaf, while others depend on > the status of the node (composite pattern). So here the traversal > operation would use a classwide parameter, while the action applied > within it, would dispatch. > Another example is having a "traversable" interface with get_first/get_next/end_of_sequence operations, and creating various general algorithms (like filters). Ehud Lamm