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 07:38:10 PST Path: archiver1.google.com!newsfeed.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!fu-berlin.de!uni-berlin.de!b882b.pppool.DE!not-for-mail From: dmitry@elros.cbb-automation.de (Dmitry A. Kazakov) Newsgroups: comp.lang.ada Subject: Re: When to use 'Class in a parameter list Date: Tue, 24 Jul 2001 14:39:34 GMT Message-ID: <3b5d84c8.2078511@news.cis.dfn.de> References: <9ji1b3$4pi$1@nh.pace.co.uk> <9ji5j7$hlu$1@news.huji.ac.il> <9jjqt0$o1s$1@nh.pace.co.uk> NNTP-Posting-Host: b882b.pppool.de (213.7.136.43) X-Trace: fu-berlin.de 995985487 25378104 213.7.136.43 (16 [77047]) X-Newsreader: Forte Free Agent 1.21/32.243 Xref: archiver1.google.com comp.lang.ada:10517 Date: 2001-07-24T14:39:34+00:00 List-Id: On Tue, 24 Jul 2001 08:49:36 -0400, "Marin David Condic" wrote: >O.K. So if I make it a 'Class, it does not require runtime dispatching? The >compiler knows from the type that it can simply degenerate to the specific >operation, rather than jump to a dispatch table? No there is no specific operation. A class-wide operation works for all derived types. >Now you've got me thinking it should dispatch. Does it or does it not? Never. A class-wide actual is passed as-is. >I sort of conceptualized the 'Class operations (based on examples from a >couple of books - which I badly need to re-read apparently! :-) as "This >procedure should work on anything derived from this class because it only >operates on the base-level components and generally should not be something >that is overriden". Whereas, the operations on some base type without the >'Class operation seemed to be saying to me "O.K. This operation works on the >base type, but you will probably be overriding it to provide additional >capabilities when you derive a child type." Perhaps my conception of this is >inaccurate... > >Maybe you can help me get my brain straightened out about this. I vaguely >remember understanding this a couple of years ago when I was last fooling >with it, but not having used it recently or enough, it is confusing me >again. I consider class-wide operations as a substitution for generic routines parametrized by a type. The possible values of the generic parameter are restricted to the class (the set of derived types). The goal is same as for generics: to write code that works for some set of types. Advantages are: no instantiation required, a class-wide operation can be put into a library etc. Regards, Dmitry Kazakov