[Date Prev][Date Next][Thread Prev][Thread Next][Author Index][Date Index][Thread Index]
The new Constructor Bomb stuff
- To: <ravi@xxxxxxxxxxx>
- Subject: The new Constructor Bomb stuff
- From: Mark S. Miller <vlad!mark>
- Date: Thu, 9 Aug 90 21:17:35 PDT
- Cc: <xtech@xxxxxxxxxxx>
- In-reply-to: <Ravi>,49 PDT <9008092352.AA17804@xanadu>
Date: Thu, 9 Aug 90 16:52:49 PDT
From: xanadu!ravi (Ravi Pandya)
In the application model code, I will commonly create a schnert
without assigning the pointer anywhere; the process of construction
adds it to a dependents list which keeps it alive. Is this still OK?
Is there any change in how I do it?
--ravi
A sample code fragment:
!UserModel methodsFor: 'create'!
create: application {ApplicationModel} with: km {KeyMaster}
....
myHomeDocument _ WaldoModel make.
User2HomeDocumentSchnert create: self with: myHomeDocument.
....
Sorry, this no longer works. We worried about this case, but decided
that it wasn't worth supporting. To a first approximation,
constructors should only be called from within pseudo-constructors,
which in turn return their result. If in the above code you replace
the "create:" call with the corresponding "make:" call, and write the
necessary pseudo-constructor, then the problem goes away.