comp.lang.ada
 help / color / mirror / Atom feed
From: Niklas Holsti <niklas.holsti@tidorum.invalid>
Subject: Re: Dynamic binding
Date: Sat, 14 Apr 2012 09:41:25 +0300
Date: 2012-04-14T09:41:25+03:00	[thread overview]
Message-ID: <9uskglFbmqU1@mid.individual.net> (raw)
In-Reply-To: <55tfbsnll3t0$.1hx68o0qdhb90$.dlg@40tude.net>

On 12-04-13 23:55 , Dmitry A. Kazakov wrote:
> On Fri, 13 Apr 2012 13:13:17 -0700 (PDT), Katarina Olsson wrote:
>
>> I have a question about dispatching in Ada. As we know, methods in
>> java are always called on their objects. Let say that we have a class
>> Parent with methods a() and b(), where a calls b like this:
>>
>> class Parent{
>>
>> public void a() {
>> System.out.println("parent a");
>> b();
>> }

As Dmitry explained, in Java the call b() (re)dispatches, while in Ada 
is does not; if you want redispatch in Ada, you must ask for it by using 
a class-wide type.

Dmitry explained well the Ada alternatives. However, not all Ada users 
agree with Dmitry's view that redispatching is unsafe. I often use 
redispatching to get the behaviour I want. Of course, the user of an 
operation must be aware of which operations use redispatching, so 
redispatching behaviour must be documented in the descriptions of the 
operations.

-- 
Niklas Holsti
Tidorum Ltd
niklas holsti tidorum fi
       .      @       .



  reply	other threads:[~2012-04-14  6:41 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-13 20:13 Dynamic binding Katarina Olsson
2012-04-13 20:55 ` Dmitry A. Kazakov
2012-04-14  6:41   ` Niklas Holsti [this message]
2012-04-14  7:39   ` Simon Wright
2012-04-14  8:58     ` Dmitry A. Kazakov
2012-04-15 12:04 ` AdaMagica
  -- strict thread matches above, loose matches on Subject: below --
2012-04-13 20:11 Katarina Olsson
2012-04-14  8:43 ` Georg Bauhaus
2012-04-14 17:17   ` Simon Wright
replies disabled

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