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-23 14:41:14 PST Path: archiver1.google.com!newsfeed.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!cpk-news-hub1.bbnplanet.com!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 00:39:10 +0300 Organization: The Hebrew University of Jerusalem Message-ID: <9ji5j7$hlu$1@news.huji.ac.il> References: <9ji1b3$4pi$1@nh.pace.co.uk> NNTP-Posting-Host: di3-5.dialin.huji.ac.il X-Trace: news.huji.ac.il 995924392 18110 132.64.13.5 (23 Jul 2001 21:39:52 GMT) X-Complaints-To: abuse@news.huji.ac.il NNTP-Posting-Date: Mon, 23 Jul 2001 21:39:52 +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:10483 Date: 2001-07-24T00:39:10+03:00 List-Id: Marin David Condic wrote in message news:9ji1b3$4pi$1@nh.pace.co.uk... > So unless I'm doing something strange that is causing some corner-case to > come up, I'm now wondering why I would need Base_Type'Class as a parameter > type? I was under the impression that I would use 'Class if I wanted to make > an operation that worked on anything derived from the class without explicit > conversion. (Possible to override it in a child class, AFAIK...) You mean _impossible_ right? Basically if you want overriding to be an option you use a primitive operation. Notice that you have to think about the possible evolution of the system, not about how things work the first time around. The main question is not about the conversion, but whether calling the routine requires run-time dispatching. (essentialy, the class-wide routine doesn't need dispatching). The Rationale has a couple of tables that nicely show the dispatching/non-dispatching semantics of the various parameter lists. It may be helpful to think of class-wide routines as a language incarnation of the "template method" design pattern. They allow you to specify a general alogirthm that may work differently on different derived types, by invoking dispatching routines. (Now, I must admit, this would work better with MI, but MI is evil...) Ehud Lamm