comp.lang.ada
 help / color / mirror / Atom feed
From: comar@cs.nyu.edu (Cyrille Comar)
Subject: Re: An Ada9X mimic of C++ friends?
Date: 10 Feb 1995 18:11:59 -0500
Date: 1995-02-10T18:11:59-05:00	[thread overview]
Message-ID: <3hgrrv$nc0@lang8.cs.nyu.edu> (raw)
In-Reply-To: 3hcao9$96b@solar.sky.net

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




  parent reply	other threads:[~1995-02-10 23:11 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1995-02-07 13:55 An Ada9X mimic of C++ friends? Donald M Needham
1995-02-07 22:38 ` David Weller
1995-02-08  9:32 ` Michel Gauthier
1995-02-08 16:27 ` Cyrille Comar
1995-02-09  5:55   ` John Howard
1995-02-09  9:59     ` Stephane Barbey
1995-02-09 21:16     ` Norman H. Cohen
1995-02-10 23:11     ` Cyrille Comar [this message]
  -- strict thread matches above, loose matches on Subject: below --
1995-02-07 19:56 Dave Papay M/S 7G32 x2791
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox