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.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,acb50cdf95d3e13c X-Google-Attributes: gid103376,public From: boschg@cs.utwente.nl (Geert Bosch) Subject: Re: Extending A Generic Signature Package Date: 1997/03/21 Message-ID: <5gtvbv$1nj@pandora.cs.utwente.nl>#1/1 X-Deja-AN: 227269078 Distribution: world References: <5gkv23INN3rn@thalamus.cis.ohio-state.edu> <5gn90o$gm1@sutton.cs.columbia.edu> X-Server-Date: 21 Mar 1997 12:36:15 GMT Organization: University of Twente, Dept. of Computer Science Newsgroups: comp.lang.ada Date: 1997-03-21T12:36:15+00:00 List-Id: Alexander V. Konstantinou (akonstan@news.cs.columbia.edu) wrote: : OO people will tell you to use inheritance, but there is : really no reason to pay for the overhead when your abstraction : can be served by a compile-time check. You shouldn't confuse using tagged types with dynamic dispatching. Suppose you have this situation: type Base is tagged record ... end record; procedure Op1 (X : in out Base); procedure Op2 (X : in out Base); type Extended is new Base with ...; procedure Op1 (X : in out Extended); procedure Op3 (X : in out Extended); In this case you can just declare an object of type Extended and use the operations Op1, Op2 and Op3 without any overhead due to dispatching. Dispatching occurs when you use (pointers to) class-wide types like in the following case: declare type Object_Ptr is access all Base'Class; X : Object_Ptr := new Base; begin Op1 (X.all); end; So whether a call to a primitive operation on a tagged type is dispatching or not is determined at the call-site. I don't know why you wouldn't want to use tagged types in your situation. The per-object space overhead shouldn't be more than one or to pointers in most compilers. Regards, Geert