comp.lang.ada
 help / color / mirror / Atom feed
From: "David Thompson" <david.thompson1@worldnet.att.net>
Subject: Re: point by point advantages of Ada
Date: Mon, 06 Jan 2003 23:13:02 GMT
Date: 2003-01-06T23:13:02+00:00	[thread overview]
Message-ID: <24oS9.30853$p_6.2594702@bgtnsc04-news.ops.worldnet.att.net> (raw)
In-Reply-To: 8EIP9.19113$p_6.1493222@bgtnsc04-news.ops.worldnet.att.net

James S. Rogers <jimmaureenrogers@worldnet.att.net> wrote :
...
> The solution for such a need is basically the same in both C++ and Ada.
> C++ provides no multiple dispatch capability. You must make such a
> function static, not virtual. In Ada you do the same thing. You simply
> define the procedure(s) taking more than one tagged type in another
> scope. An inner package is a common choice for another scope.
>
static is not the opposite of virtual, see below.  In C++ you can allow
the normal, implicit dispatch on one type (virtual) and do the other(s)
explicitly; or have a nonvirtual function that does both/all.  Yes in Ada
the options are effectively the same.

...
> What the original author does not mention is that C++ cannot dispatch
> based upon the return type of a function. This is done cleanly in Ada and
> not at all in C++ (or Java).
>
Ada uses return type to resolve overloading (at compile time), but
not to dispatch (possibly at run time).  (C++ and Java do neither.)

> In C++ you need to explicitly label a function as "virtual". The default is
> "static". In Java the default is the equivalent of virtual, and you must
> explicitly label "static" functions with the "static" keyword. In Ada
> functions are primitive to a type if they are declared in the same scope
> as the declaration of the type. That is, the "primitive" property is defined
> by scope, and not by the presence or absence of a reserved word.
> This is different from C++ and Java, but those languages also differ
> from each other. Such differences do not prove superiority.
>
C++ virtual and Java *final* are opposites, and yes the default is
reversed, but *static* (in both) is quite different -- it specifies methods
or variables which are per-class not per-instance.  (As well as having
other meanings in C++, and C, for things not in a class.)

--
- David.Thompson 1 now at worldnet.att.net






  reply	other threads:[~2003-01-06 23:13 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-12-26 21:57 point by point advantages of Ada Russ
2002-12-27 10:54 ` Ingo Marks
2002-12-27 21:11   ` Keith Thompson
2002-12-27 21:31     ` Robert A Duff
2002-12-29 18:31 ` Colin Paul Gloster
2002-12-29 20:09   ` James S. Rogers
2003-01-06 23:13     ` David Thompson [this message]
2003-01-07  1:35       ` James S. Rogers
2003-01-07 19:34         ` Randy Brukardt
2003-01-07 21:53           ` Warren W. Gay VE3WWG
2003-01-08  0:36             ` Richard Riehle
2003-01-08 17:50               ` Warren W. Gay VE3WWG
2003-01-08 20:31             ` Randy Brukardt
2003-01-13 16:37               ` Mark Biggar
2002-12-29 21:56   ` Hyman Rosen
2002-12-29 22:30     ` John R. Strohm
2002-12-29 23:16       ` Hyman Rosen
2003-01-02 14:24         ` Wes Groleau
2003-01-03  8:20           ` Hyman Rosen
2003-01-03 14:00             ` Wes Groleau
2003-01-08 20:55               ` Georg Bauhaus
2002-12-29 19:20 ` chris.danx
replies disabled

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