weak hash table for cstructs needs ephemerons
svn: r8353 original commit: 74062d996f96be38a2a36b202d6bbd6bc835edcb
This commit is contained in:
parent
ac830fc73e
commit
15b2bb3c4a
|
@ -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)]))))
|
||||
|
||||
;; ----------------------------------------------------------------------------
|
||||
|
|
Loading…
Reference in New Issue
Block a user