($deftest srfi-124-ephemerons ($import! emacs-global garbage-collect) ($letrec ((fn ($λ (k v) ($let ((e (make-ephemeron k (cons k v)))) (garbage-collect) (reference-barrier k) e)))) ($let* ((v "value") (e ($let ((e (fn (list 42) v))) ($should (not? (ephemeron-broken? e))) ($should (equal? (cons (list 42) "value") (ephemeron-value e))) ;; This triggers the bad behavior of the interpreter: ((constant #inert) (ephemeron-key e)) (garbage-collect) ;; ($should (ephemeron-broken? e)) (display "Should be (#t #f #f): ") ;; Unfortunately, this prints (#f (42) ((42) . "value")) (writenl (list (ephemeron-broken? e) (ephemeron-key e) (ephemeron-value e))) e))) ;; Here the return value of the first ephemeron-key call has ;; disappeared from the stack: (garbage-collect) ($should (ephemeron-broken? e)) ($should (eq? #f (ephemeron-key e))) ($should (eq? #f (ephemeron-value e))))))