comp.lang.ada
 help / color / mirror / Atom feed
From: Lutz Donnerhacke <lutz@iks-jena.de>
Subject: Re: Limited_Controlled types as 'out' arguments
Date: Wed, 30 Jul 2003 12:32:17 +0000 (UTC)
Date: 2003-07-30T12:32:17+00:00	[thread overview]
Message-ID: <slrnbifemd.o6.lutz@taranis.iks-jena.de> (raw)
In-Reply-To: stcfivs5gk0u0gvhefqohlmhjheg1gshl0@4ax.com

* Dmitry A Kazakov wrote:
> On Wed, 30 Jul 2003 11:31:03 +0000 (UTC), Lutz Donnerhacke
>>   procedure Copy(to : out Test; from : Test);
>>
>>Clearly, the variable 0 and 3 are never finalized. How implement I this
>>correctly (without refering to the rosen trick).
>
> 1. Why do you think that it is incorrect? Copy does not destruct the
>    target, so why should it call Finalize?

In my implementation, the type Test contains an array_access, I have to
deallocate, before assigning a new value. I can not deallocate this access
variable, because the procedure Free (unchecked_deallocate) requires an
'in out' Parameter. But I only have an 'out' paramter. So I can't read it,
before the first write.

In short: The former contents (despite discriminates) of an 'out' parameter
are not available inside the procedure. So the former contents are not
finalizable inside this procedure.

> procedure Copy (To : in out Test'Class; From : Test'Class) is
> begin
>    Destruct (To);
>    Construct (To, From);
> end Copy;

Fine, but try this with the prototype:
  procedure Copy (To : out Test'Class; From : Test'Class);

> Beware, true multiple dispatch is not supported in Ada. So if you want
> to copy objects of different types you have to simulate MD.

Wrong answer. Not every problem is MI related.



  reply	other threads:[~2003-07-30 12:32 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-07-30 11:31 Limited_Controlled types as 'out' arguments Lutz Donnerhacke
2003-07-30 12:22 ` Dmitry A. Kazakov
2003-07-30 12:32   ` Lutz Donnerhacke [this message]
2003-07-30 14:24     ` Dmitry A. Kazakov
2003-07-30 14:25       ` Lutz Donnerhacke
2003-07-30 14:48         ` Dmitry A. Kazakov
2003-07-30 15:15           ` Lutz Donnerhacke
2003-07-31 10:26             ` Dmitry A. Kazakov
2003-07-31 10:54               ` Lutz Donnerhacke
2003-07-31 11:50                 ` Dmitry A. Kazakov
2003-07-31 12:19                   ` Lutz Donnerhacke
2003-07-31 13:15                     ` Dmitry A. Kazakov
2003-07-31 17:51                 ` Randy Brukardt
2003-07-30 15:01         ` Vinzent Hoefler
2003-07-30 15:16           ` Lutz Donnerhacke
2003-07-30 15:52         ` Lutz Donnerhacke
2003-07-30 19:30           ` Randy Brukardt
2003-07-31  7:43             ` Lutz Donnerhacke
2003-07-30 12:31 ` Matthew Heaney
2003-07-30 12:57   ` Lutz Donnerhacke
2003-07-30 13:47     ` Martin Dowie
2003-07-30 17:06     ` Matthew Heaney
2003-07-30 12:37 ` Martin Dowie
2003-07-30 12:59   ` Lutz Donnerhacke
2003-07-30 13:41     ` Martin Dowie
replies disabled

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