1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-05 03:30:24 +02:00

Add ephemeron-table-clear!; ephemeron key can be immediate

* libguile/ephemerons.c (scm_make_ephemeron): Relax restriction that key
be a heap object.  It's too annoying otherwise.
(scm_c_ephemeron_table_clear_x):
(scm_ephemeron_table_clear_x): New interface.
* module/ice-9/ephemerons.scm: Expose ephemeron-table-clear!.
* test-suite/tests/ephemerons.test ("ephemerons"): Update tests.
This commit is contained in:
Andy Wingo 2025-05-13 14:55:38 +02:00
parent c35cbd65f1
commit d457aaa57d
4 changed files with 49 additions and 10 deletions

View file

@ -27,14 +27,10 @@
(pass-if (ephemeron? (make-ephemeron (cons 42 42) 42)))
(with-test-prefix "ephemeron key not heap object"
(pass-if-exception "fixnum" exception:wrong-type-arg
(make-ephemeron 42 42))
(pass-if-exception "char" exception:wrong-type-arg
(make-ephemeron #\a 42))
(pass-if-exception "bool" exception:wrong-type-arg
(make-ephemeron #f 42))
(pass-if-exception "bool" exception:wrong-type-arg
(make-ephemeron #t 42)))
(pass-if "fixnum" (ephemeron? (make-ephemeron 42 42)))
(pass-if "char" (ephemeron? (make-ephemeron #\a 42)))
(pass-if "bool" (ephemeron? (make-ephemeron #f 42)))
(pass-if "bool" (ephemeron? (make-ephemeron #t 42))))
(let ((x (cons 42 69)))
(define e (make-ephemeron x 100))