An object. You are free to use your own notion of pointing, for example, it may be the key in a hash table.
A symbol or a list starting with a symbol.
A function designator or a list starting with a function designator.
A function designator or a list starting with a function designator, or
delivery-shaker-weak-pointer is used to make a pointer from one object pointing to another weak object pointed during the shaking operation. The operations of
nil, and creates a record with all the arguments for the shaker.
nil) using the accessor.
If pointed is
nil and the accessor returns
nil, the shaker does not do anything else for this record. Otherwise, it stores weak pointers to both the pointing object and the pointed object, and uses the remover to remove the pointer from the pointing object.
If accessor is a symbol then it specifies a function that is called with the pointing object as its argument. If accessor is a list then the
car of the list is called with the pointing object as its first argument, and the
cdr of the list forming the rest of the arguments, that is:
If setter is
nil, it is computed by the system using accessor and the same expansion that
setf would use. If setter is non-nil, it has the same properties as the accessor, except that in the call the pointed object is inserted before the rest of the arguments. That is, if setter is
(set-something name), the call is
(set-something pointed pointing name
). In addition, where the accessor accepts a symbol, the setter also accepts a function object.
The default value of remover is
which means use the setter. remover is used to remove the pointer from the pointing object. It is called exactly like the setter, except that the first argument is dead-value, rather than pointed.
The default value of dead-value is
nil. This the value that is stored by the remover in the pointing value before starting the shaking. Note that if the pointed object is shaken, the pointing object is left with the dead-value.
Note that between the calls to the remover and the setter (steps 2 and 3 above), the pointing object points to the wrong thing (the dead-value). This may cause problems if the object is used by the system during the shaking (this does not happen unless you access objects which you should not access), or if you define more than one
delivery-shaker-weak-pointer on the same object, and one of these uses a slot that has been defined by the other. Thus you have to make sure that you do not cause this situation.
Suppose the keys of
*my-hash-table* are conses of an object and a number, and it is desired to remove from
*my-hash-table* those entries where the
car is not pointed to from anywhere else. This can be done by something like this :
(when (eq (car x) 'my-dead-value) (remhash x table))
The value of
*aaa* is a list of objects of type
a-struct, which has a slot called
name, which points to a symbol. We want to get rid of any of these structures if the symbol is not pointed to by some other object.
Make a pointer from the symbol to the structure, and make
*aaa* point weakly to the names, and set
nil. The remover and accessor do nothing, and the setter is defined to restore
*aaa*. This implementation does not use the cleanup function.
LispWorks Delivery User Guide - 15 Feb 2015