[gclist] Finalization and object orientation.

Giuliano Carlini GCARLINI@us.oracle.com
02 Apr 97 04:14:51 -0800

Content-Type:text/plain; charset="iso-8859-1"

OOOPS!. Of course A must finalize before B if it=0D=0Adepends on B. My main=
 point was that the finalization=0D=0Agraph appears to be a DAG, and I got =
my fingers working=0D=0Across eyed when I typed which needs to be finalized=
=0D=0Afirst. I'm having a hell of a time unknotting my=0D=0Afingers from ea=
ch other...=0D=0A=0D=0Ag=0D=0A=0D=0A=0D=0A=


Date: 01 Apr 97 18:15:56
From:"Guillermo (Bill) J. Rozas <gjr@hplgr2.hpl.hp.com>" <majordom@iecc.com>
Subject:Re: [gclist] Finalization and object orientation.
Sender:majordom@iecc.com (MajorDomo)
In-reply-to:<199703311918.LAA13907@mailsun3-fddi.us.oracle.com> (GCARLINI@us.oracle.com)
Precedence: bulk
MIME-Version: 1.0
Content-Type:text/plain; charset="iso-8859-1"

|   Date: 31 Mar 97 11:05:35 -0800=0A|   From: "Giuliano Carlini" <GCARLINI=
@us.oracle.com>=0A|   Subject: Re: [gclist] Finalization and object orienta=
tion.=0A|   =0A|   ...=0A|   But, I don't think we need to handle cycles. F=
inalization=0A|   order usually indicates dependence. If A is dependent on =
B,=0A|   then B must finalize before A. A and B can't be both dependent=0A|=
   upon one another, or there is no possible way to finalize=0A|   them. I =
therefore believe that a dependence graph is=0A|   necessarily a DAG.=0A=0A=
Are you sure about that?  Almost all cases that I have seen have the=0Aoppo=
site relationship, namely that if A depends on (encapsulates) B,=0Athen A m=
ust be finalized before B.=0A=0AFor example, assume that we have a language=
/system which creates files=0Asuch that if they are not explicitly closed w=
ith a save/commit option,=0Athey are reclaimed.  I.e. the finalization (whe=
n not explicitly=0Aclosed) is "close and delete".  On top of that (the basi=
c file object=0Aprovided by the runtime library) we want to build a file ob=
ject A that=0Ahas the opposite semantics, i.e. if not explicitly "aborted",=
 "close=0Aand save".  Clearly A depends on B which is the primitive file ob=
ject=0Ain the system.  On the other hand, A must finalize before B, to=0Apr=
event B from deleting it before A takes action.=0A=0AHowever, I agree that =
the dependence graph is a DAG.=0A=0A|   ...=0A|   I never suggested using t=
he reference graph to determine the=0A|   dependence graph. Explicit declar=
ation of mutator semantics=0A|   is the best course in my opinion.=0A=0AI t=
hink this is an important point, and fits with my experience.=0AMy experien=
ce is that you can have a "declaration" of the following=0Aform:=0A=09=0A=
=09(finalize! object set-of-objects action)=0A=0Awhere OBJECT must be final=
ized _before_ any of the objects in=0ASET-OF-OBJECTS (which may obviously b=
e empty) by invoking=0Aclosure/method ACTION.=0A=0AFINALIZE! constructs the=
 dag and checks for cycles outside of the=0Acollector.  The collector then =
has no problem determining finalization=0Aorder.=0A=0AOf course, other decl=
arations are useful as well.=0A=