Re: Usefulness of reference-barrier
Marc Nieper-Wißkirchen 13 Oct 2025 11:17 UTC
PPS The following program for Chez Scheme demonstrates the issue (not
that I dropped the argument to G, which I also dropped in my text
above (but forgot to remove in the code example):
**
(import (scheme))
(define eph #f)
(define (f v)
(set! eph (ephemeron-cons v #t)))
(define (g)
(car eph))
(define (g/collect)
(collect) ;simulate GC
(car eph))
(define foo
(lambda (f g)
(let ((v (vector 1 2)))
(f v)
(let ((w (g)))
(boolean=? (vector? v) (vector? w))))))
(assert (foo f g))
(assert (foo f g/collect)) ;fails
**