comp.lang.ada
 help / color / mirror / Atom feed
From: Jim Rogers <jimmaureenrogers@worldnet.att.net>
Subject: Re: OO in Ada
Date: Sat, 05 Oct 2002 00:20:43 GMT
Date: 2002-10-05T00:20:43+00:00	[thread overview]
Message-ID: <3D9E3018.8000403@worldnet.att.net> (raw)
In-Reply-To: 1033752899.224298@master.nyc.kbcfp.com

Hyman Rosen wrote:

> Jim Rogers wrote:
>  > In C++ this syntax is good for virtual functions
>  > but illegal for static functions. This causes nasty
>  > problems in C++ template construction.
> 
> You don't mean 'virtual' and 'static', you mean
> 'member function' and 'non-member function'. It's
> not so much an issue of nasty problems. It's just
> that having two different notations for calling a
> method means that when you're writing a template
> you have to know which notation to use, which
> limits its genericity.


Thank you. That is just what I wanted to say if I
knew C++ better. Sorry about the error.


> 
>  > C++ (and Java) forbid dispatching based upon the
>  > return type of a function. This is one of the
> 
>> side effects of the 'object.method' notation.
> 
> 
> Your first statement is true, but your second is
> false. Why do you think object.method would prevent
> dispatching on return type?
> 


I think that because the dispatching is always performed on the
type of "object" in object.method. This rule would have to be
seriously modified to dispatch on the return type of a function
(or method in Java's terminology).


>> should be phased out by allowing [member] functions
> 
>  > to be called in the same way as [non-member] functions.
> 
> It will never be phased out, of course, since that would
> destroy millions of lines of code. Someone might come up
> with a reasonable proposal for allowing the method(object)
> notation, though. The problem is the impact this owuld have
> on overloading and name lookup, which is already extremely
> complicated.
> 
> The design issue for C++ is that sometimes you want member
> functions as part of an interface and sometimes you want
> standalone functions. Having a different calling notation
> makes it harder to switch the function from one type to the
> other, because you have to modify all the callers.
> 
> On the other hand, Ada gives the illusion of multiple dispatch
> by allowing several parameters to control dispatching, but then
> forcing them all, at runtime, to have the same dynamic type. I
> suppose some future version of Ada could lift this restriction
> while keeping the same notation, which is good.
> 
> 


I disagree here. Ada does not give the illusion of multiple dispatch.
An Ada subprogram can only be primitive to one type. That characteristic
is determined by the place in the source code where the subprogram
interface is defined. I am not really happy with this design feature,
but it is what it is.

Jim Rogers







  reply	other threads:[~2002-10-05  0:20 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-10-04  2:14 OO in Ada Rick Duley
2002-10-04  2:55 ` Jim Rogers
2002-10-04 17:35   ` Hyman Rosen
2002-10-05  0:20     ` Jim Rogers [this message]
2002-10-05 23:38       ` Dmitry A.Kazakov
2002-10-05 15:25         ` Jim Rogers
2002-10-06 21:37           ` Dmitry A.Kazakov
2002-10-06  2:18       ` Hyman Rosen
2002-10-06  3:00         ` Jim Rogers
2002-10-08 21:08           ` Gisle Sælensminde
2002-10-04  3:37 ` Chad R. Meiners
2002-10-04  5:32 ` Simon Wright
2002-10-04  6:01 ` tmoran
2002-10-04 15:05 ` Matthew Heaney
2002-10-05  2:14 ` SteveD
2002-10-05  8:54   ` Preben Randhol
2002-10-07 14:10   ` Matthew Heaney
2002-10-07 19:52     ` Jeffrey Carter
2002-10-08 21:18     ` Dmitry A.Kazakov
2002-10-08  9:53 ` John McCabe
2002-10-08 15:37   ` Matthew Heaney
2002-10-08 16:47     ` Georg Bauhaus
2002-10-08 17:48       ` Matthew Heaney
2002-10-08 17:16     ` Warren W. Gay VE3WWG
2002-10-08 17:58       ` Matthew Heaney
2002-10-09 16:59         ` Warren W. Gay VE3WWG
2002-10-08 10:21 ` Preben Randhol
  -- strict thread matches above, loose matches on Subject: below --
1998-05-15  0:00 Gisle S{lensminde
replies disabled

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