comp.lang.ada
 help / color / mirror / Atom feed
* differentiating finalization causes
@ 1997-10-29  0:00 Pat Rogers
  1997-11-01  0:00 ` Matthew Heaney
  0 siblings, 1 reply; 2+ messages in thread
From: Pat Rogers @ 1997-10-29  0:00 UTC (permalink / raw)



For a type descended from Controlled, I need to be able to differentiate
finalization due to object destruction from finalization due to assignment
("value destruction", if you will).  At present I use the subsequent call
to Adjust to set a flag, with other routines checking the flag to see if
the effect of Finalize was really due to assignment.  However, Finalize is
responsible for placing an item in a list, and Adjust must search the list,
looking for the corresponding node (in which to set the flag).  I don't
want to search this list each time Adjust is called, but of course I cannot
keep a pointer to the node in the controlled object itself, since
assignment will overwrite it with the value on the right-hand side.  Are
there any "tricks" or techniques for differentiating between the two causes
of finalization?





^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: differentiating finalization causes
  1997-10-29  0:00 differentiating finalization causes Pat Rogers
@ 1997-11-01  0:00 ` Matthew Heaney
  0 siblings, 0 replies; 2+ messages in thread
From: Matthew Heaney @ 1997-11-01  0:00 UTC (permalink / raw)



In article <01bce4a2$b0ad17e0$020c6dce@my-pc.neosoft.com>, "Pat Rogers"
<progers@acm.org> wrote:

>For a type descended from Controlled, I need to be able to differentiate
>finalization due to object destruction from finalization due to assignment
>("value destruction", if you will).

This issue pops up from time to time, but something about it strikes me as
odd.  Can you explain more about why you need to differentiate between the
two cases?

What about making the type limited?  That would make the issue disappear,
because no assignment is allowed.  You could even export a Copy operation
if you need to.

--------------------------------------------------------------------
Matthew Heaney
Software Development Consultant
<mailto:matthew_heaney@acm.org>
(818) 985-1271




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~1997-11-01  0:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1997-10-29  0:00 differentiating finalization causes Pat Rogers
1997-11-01  0:00 ` Matthew Heaney

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