[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: DEFSTRUCT and reclaimable storage



You needn't worry about intense philosophical disagreement from the Lisp
Machine system hacker community; while automatic freeing of storage is
nice, we all recognize that sometimes you don't need it and can gain a
lot of efficiency by using manual returning.  In fact, there is
currently an installed Lisp Machine system feature called "resources"
that do something like what you want.  You can define a new resource,
which gives the resource a name and says how to make a new object; then
you can say (with-resource (<resource-name> <var>) form1 form2 ...)
which will lambda-bind <var> to an object from the <resource-name>
resource.  When you exit the special form (with a normal or THROW-type
exit), the item is returned to the resource pool.

So the way you would do what you want to do is to define a new resource
whose definition includes a defstruct constructor macro.  This should
not be built into defstruct, since you might also want a resource of
objects that are not structures (arrays, flavor instances, 1000-long
lists, etc.).

I am not sure whether anyone has documented the functions and special
forms of the resource feature.  If I find out that they are not
documented, I will document them.