comp.lang.ada
 help / color / mirror / Atom feed
From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: Why is the destructor called multiple times after I declare an object?
Date: Thu, 14 Jan 2016 14:42:53 +0100
Date: 2016-01-14T14:42:53+01:00	[thread overview]
Message-ID: <n788li$12uf$1@gioia.aioe.org> (raw)
In-Reply-To: n77rmb$d0c$1@dont-email.me

On 14/01/2016 11:04, Georg Bauhaus wrote:
> On 13.01.16 20:59, Dmitry A. Kazakov wrote:
>> Sure, some object is always returned and every object is always same
>> to itself. This is not sufficient to define useful "in-place". In my
>> view a definition must have the place known at the caller's context.
>> E.g. to have the object:
>>
>> 1. Allocated at a specific machine address
>> 2. Allocated by an allocator in the specific memory pool
>> 3. Allocated as a specific component of a container object
>> 4. Allocated as a parent of a derived type object
>>
>> The problem of returned object is that it conflates allocation with
>> initialization.
>
> If Ada will have a way for the caller to express the placement of new
> objects to be constructed in situ by functions,

By procedures, of course. Initializer must a procedure.

> might we then go back to just
> return-by-reference in the hope of abandoning "return-by-access"?

There is a simpler and cleaner way. What is needed is user-defined 
procedures implementing record/array component read and update access as 
primitive operations. No need to implement the syntax sugar

    X.M := F (...)

literally as two separate evaluations of X.M and F(...) with inventing 
some intermediate objects to pass to some virtual assignment meaningless 
for limited types anyway. It should be

    Set_M (X, ...);

with lots of problems with limited and indefinite types eliminated.

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de


  reply	other threads:[~2016-01-14 13:42 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-11  1:37 Why is the destructor called multiple times after I declare an object? Andrew Shvets
2016-01-11  2:18 ` Jeffrey R. Carter
2016-01-11  3:35   ` Andrew Shvets
2016-01-11 17:02     ` Brian Drummond
2016-01-11 16:29   ` Brian Drummond
2016-01-11 17:20     ` Simon Wright
2016-01-11 18:17     ` Bob Duff
2016-01-11 21:10       ` Dmitry A. Kazakov
2016-01-11 23:44         ` Randy Brukardt
2016-01-12  9:33           ` Dmitry A. Kazakov
2016-01-12 20:21             ` Randy Brukardt
2016-01-12 21:05               ` Dmitry A. Kazakov
2016-01-13  0:02                 ` Robert A Duff
2016-01-13  8:31                   ` Dmitry A. Kazakov
2016-01-13  9:01                     ` Georg Bauhaus
2016-01-13 14:45                     ` J-P. Rosen
2016-01-13 20:09                       ` Dmitry A. Kazakov
2016-01-14  9:04                         ` J-P. Rosen
2016-01-14  9:47                           ` Dmitry A. Kazakov
2016-01-13 16:03                     ` Robert A Duff
2016-01-13 19:59                       ` Dmitry A. Kazakov
2016-01-14 10:04                         ` Georg Bauhaus
2016-01-14 13:42                           ` Dmitry A. Kazakov [this message]
2016-01-12 12:41       ` Brian Drummond
2016-01-13 20:18       ` Jacob Sparre Andersen
2016-01-14  1:31         ` Robert A Duff
2016-01-12  0:43     ` Jeffrey R. Carter
replies disabled

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