[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Question about MAKE
- To: firstname.lastname@example.org
- Subject: Question about MAKE
- From: Mark Nahabedian <naha@RIVERSIDE.SCRC.Symbolics.COM>
- Date: Mon, 26 Oct 1992 09:37-0500
- Cc: Info-dylan@CAMBRIDGE.APPLE.COM
- In-reply-to: <9210260443.AA22105@myrtle.pa.dec.com>
Date: Sun, 25 Oct 1992 23:43 EST
The book says, "Dylan does not specify whether the value returned
must be a newly allocated instance, or whether MAKE is permitted
to return a previously created instance. If a new instance is allocated,
MAKE will call INITIALIZE on the instance before returning it." [page
1. If MAKE returns a previously created instance, this has got to
be something that's no longer visible to the program, right?
Consider that I have some collection of named objects and I want to
insure that no two objects will be created with the same name. My
application could use MAKE in the same way that the Lisp reader uses
INTERN to insure that if will get a preexisting symbol of a given name
rather than creating another one.
The authors of Dylan had the forseight to not add a gratuitous
restriction to MAKE which would constrain it to return a new object each
something that the garbage collector has tossed back into a weak-pointer
pool. As stated, it sounds as though MAKE could return the same
object every time!
If the garbage collector has reclaimed something, it is gone. The
storage may, and most likely will get reallocated, but the object
occupying that recycled storage is a new object, not some resurrected
zombie undead object.
2. I expect that INITIALIZE will typically be used to assign non-constant
values to slots, to attach pointers to the new object, etc. If so,
then it would seem to make sense for MAKE to call INITIALIZE even
when it's returning some "recycled" object, no?
No. This could well be the wrong behavior for the case I outlined
above. I can't imagine any circumstance inwhich it would be the right