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,c7d1d12d1859ad7f X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 1995-02-10 18:19:14 PST Path: swrinde!cs.utexas.edu!math.ohio-state.edu!uwm.edu!news.alpha.net!news.mathworks.com!panix!cmcl2!thecourier.cims.nyu.edu!thecourier.cims.nyu.edu!nobody From: comar@cs.nyu.edu (Cyrille Comar) Newsgroups: comp.lang.ada Subject: Re: An Ada9X mimic of C++ friends? Date: 10 Feb 1995 18:11:59 -0500 Organization: Courant Institute of Mathematical Sciences Message-ID: <3hgrrv$nc0@lang8.cs.nyu.edu> References: <3hcao9$96b@solar.sky.net> NNTP-Posting-Host: lang8.cs.nyu.edu Date: 1995-02-10T18:11:59-05:00 List-Id: jhoward@solar.sky.net (John Howard) writes: : designer who anticipates future use; or, it requires the user must have : access to the underlying code so that it can be changed. Both of these : are poor assumptions." : : I am new to Ada. : So my question is: does the explicit use of "TAGGED" in Ada95 have the same : negative consequences as specifying "virtual"? Being obliged to specify "virtual" in C++ is not 100% negative. It has an impact on code generation (a non-virtual function call is more efficient than a virtual function call). Anyway the Ada95 approach is different. All subprograms defined "reasonably close to the type definition" (I won't try to give the formal definition here :-) are primitive, i.e. virtual in the C++ sense and can be overridden by descendants. In the other hand the notion of Class-Wide type (which doesn't exist in C++) allows the compiler to know if the call to a primitive operation is dispatching or not so you only pay for dispatching when you actually use it. I have been told that some C++ compilers were able to optimize calls to virtual functions that are obviously not dispatching but the C++ typing mechanism doesn't give much room for this kind of optimizations... -- ------------------------------------------------------------------------ Cyrille Comar, E-mail: comar@cs.nyu.edu Gnat Project US phone: (212) 998-3489