Package COM.INFORMATIMAGO.CLEXT.CLOSER-WEAK

Closer to Weak objects.
Implements the specification: <http://clisp.cons.org/impnotes/weak.html>
for Common Lisp implementations that have weak-pointers.

WEAK-OR-RELATION is a primitive that cannot be implemented properly
without implementation support.

Currently works on:

             WP   WL   WAR WOR WM  WHT
  allegro
  ccl         x    x    x       x   n   -- WHT native.
  clisp       n    n    n   n   n   n   -- full support - native
  cmucl       n    x    x       x   x   -- partial support (missing WEAK-OR-RELATION)
  sbcl        n    x    x       x   x   -- partial support (missing WEAK-OR-RELATION)

Copyright Pascal J. Bourguignon 2006 - 2013

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or (at
your option) any later version.

MAKE-WEAK-ALIST

(make-weak-and-mapping keys value)
function
Creates a WEAK-AND-MAPPING between the keys  objects in
 the given list and the given value. The keys list must be non-empty.
(make-weak-and-relation list)
function
Creates a WEAK-AND-RELATION between the objects in the given list.

MAKE-WEAK-LIST

(make-weak-mapping key value)
function
Creates a WEAK-MAPPING.
(make-weak-or-mapping keys value)
function
Creates a WEAK-OR-MAPPING between the keys  objects in
 the given list and the given value. The keys list must be non-empty.
(make-weak-or-relation list)
function
Creates a WEAK-OR-RELATION between the objects in the given list.

MAKE-WEAK-POINTER

WEAK-ALIST-ASSOC

WEAK-ALIST-CONTENTS

WEAK-ALIST-P

WEAK-ALIST-RASSOC

WEAK-ALIST-TYPE

WEAK-ALIST-VALUE

(weak-and-mapping-p x)
function
Returns true if the object is of type WEAK-AND-MAPPING.
(weak-and-mapping-pair mapping)
function
Returns three values: the list of keys, the value, and
T, if none of the keys have been garbage-collected, else NIL, NIL,
NIL. The returned keys list must not be destructively modified.
(weak-and-mapping-value mapping)
function
Returns the value, if none of the keys have been
garbage-collected, else NIL.
(setf (weak-and-mapping-value mapping) value)
function
Replaces the value stored in the WEAK-AND-MAPPING.
It has no effect when some key has already been garbage-collected.
weak-and-relation
structure
A weak 'and' relation is an ordered collection of references to
objects, that does not keep the objects from being garbage-collected,
and which allows access to all the objects as long as all of them are
still alive. As soon as one of them is garbage-collected, the entire
collection of objects becomes empty.
(weak-and-relation-list weak-and-relation)
function
Returns the list of objects stored in the weak-and-relation.
The returned list must not be destructively modified.
(weak-and-relation-p x)
function
Returns true if the object is of type WEAK-AND-RELATION.

WEAK-LIST-LIST

WEAK-LIST-P

weak-mapping
structure
A weak association is a mapping from an object called key to an
object called value, that exists as long as the key is alive. In other
words, as long as the key is alive, it keeps the value from being
garbage-collected.
(weak-mapping-p x)
function
Returns true if the object is of type WEAK-MAPPING.
(weak-mapping-pair weak-mapping)
function
Returns true if the object is of type WEAK-MAPPING.
(weak-mapping-value weak-mapping)
function
Returns three values: the original key, the original value, and T,
if the key has not yet been garbage-collected, else NIL, NIL, NIL.
(setf (weak-mapping-value weak-mapping) value)
function
Replaces the value stored in the weak-mapping.
It has no effect when the key has already been garbage-collected.
weak-or-mapping
structure
A weak 'or' mapping is a mapping from a tuple of
objects called keys to an object called value, that keeps all keys and
the value from being garbage-collected as long as one of the keys is
still alive. In other words, each of the keys keeps all others among
them and the value from being garbage-collected. When all of them are
unreferenced, the entire mapping goes away.
(weak-or-mapping-p x)
function
Returns true if the object is of type WEAK-OR-MAPPING.
(weak-or-mapping-pair mapping)
function
Returns three values: the list of keys, the value, and
T, if the keys have not yet been garbage-collected, else NIL, NIL,
NIL. The returned keys list must not be destructively modified.
(weak-or-mapping-value mapping)
function
Returns the value, if the keys have not yet been
garbage-collected, else NIL.
(setf (weak-or-mapping-value mapping) value)
function
Replaces the value stored in the WEAK-OR-MAPPING.
It has no effect when the keys have already been garbage-collected.
weak-or-relation
structure
A weak 'or' relation is an ordered collection of references to
objects, that keeps all objects from being garbage-collected as long
as one of them is still alive. In other words, each of them keeps all
others among them from being garbage-collected. When all of them are
unreferenced, the collection of objects becomes empty.
(weak-or-relation-list weak-or-relation)
function
Returns the list of objects stored in the WEAK-OR-RELATION.
The returned list must not be destructively modified.
(weak-or-relation-p x)
function
Returns true if the object is of type WEAK-OR-RELATION.
(weak-pointer-p object)
function
Returns true if the object is of type WEAK-POINTER.

WEAK-POINTER-VALUE