From 74062d996f96be38a2a36b202d6bbd6bc835edcb Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Wed, 16 Jan 2008 23:19:07 +0000 Subject: [PATCH] weak hash table for cstructs needs ephemerons svn: r8353 --- collects/mzlib/foreign.ss | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/collects/mzlib/foreign.ss b/collects/mzlib/foreign.ss index 2a62af4e31..03812f0829 100644 --- a/collects/mzlib/foreign.ss +++ b/collects/mzlib/foreign.ss @@ -1477,10 +1477,15 @@ (define cstruct-info (let ([table (make-hash-table 'weak)]) (lambda (cstruct msg/fail-thunk . args) - (cond [(eq? 'set! msg/fail-thunk) (hash-table-put! table cstruct args)] + (cond [(eq? 'set! msg/fail-thunk) + (hash-table-put! table cstruct (make-ephemeron cstruct args))] [(and cstruct ; might get a #f if there were no slots (hash-table-get table cstruct (lambda () #f))) - => (lambda (xs) (apply values xs))] + => (lambda (xs) + (let ([v (ephemeron-value xs)]) + (if v + (apply values v) + (msg/fail-thunk))))] [else (msg/fail-thunk)])))) ;; ----------------------------------------------------------------------------