From 15740ae6b6c8476cd1a9323ffd50f85a3c8ea245 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Sun, 12 Jul 2020 11:29:33 -0700 Subject: Support weak semantics in symbol packages. A package is weak if it holds weak references to symbols, meaning that if there are no references to a symbol other than its entry in a weak package, it can be removed from the package and reclaimed by the garbage collector. * eval.c (eval_init): Update registrations for make-package and sys:make-anon-package to reflect new optional argument. * lib.c (make_package_common): New argument weak. If it is true then both the hashes will have weak values. (make_package, make_anon_package): New optional argument weak. (obj_init): Add nil argument to calls to make_package. All the standard packages are regular, not weak. * lib.h (make_package, make_anon_package): Declarations updated. * txr.1: Documented. --- lib.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib.h') diff --git a/lib.h b/lib.h index 330ae34f..fc4dfebd 100644 --- a/lib.h +++ b/lib.h @@ -928,8 +928,8 @@ val compl_span_str(val str, val set); val break_str(val str, val set); val make_sym(val name); val gensym(val prefix); -val make_package(val name); -val make_anon_package(void); +val make_package(val name, val weak); +val make_anon_package(val weak); val packagep(val obj); val find_package(val name); val delete_package(val package); -- cgit v1.2.3