Have id-table-ref! call its failure thunks.

Closes PR15346.
This commit is contained in:
Vincent St-Amour 2016-09-28 16:13:55 -05:00
parent a1a2d9c2c7
commit 456a72a36c
2 changed files with 5 additions and 1 deletions

View File

@ -400,6 +400,8 @@
(test 0 bound-id-table-ref! table x0 0)
(test 1 bound-id-table-ref! table x1 1)
(test 0 bound-id-table-ref! table x0 (lambda () 0))
(test 1 bound-id-table-ref! table x1 (lambda () 1))
(test 0 bound-id-table-ref table x0)
(test 1 bound-id-table-ref (bound-id-table-update table2 y0 add1 0) y0)
(test 1 bound-id-table-ref (bound-id-table-set* table2 y0 0 y1 1) y1)
@ -417,6 +419,8 @@
(test 0 free-id-table-ref! table x0 0)
(test 1 free-id-table-ref! table x1 1)
(test 0 free-id-table-ref! table x0 (lambda () 0))
(test 1 free-id-table-ref! table x1 (lambda () 1))
(test 0 free-id-table-ref table x0)
(test 1 free-id-table-ref (free-id-table-update table2 y0 add1 0) y0)
(test 1 free-id-table-ref (free-id-table-set* table2 y0 0 y1 1) y1)

View File

@ -161,7 +161,7 @@ The {key,value}-{in-out} functions should all return a chaperone of their argume
(define entry (id-table-ref who d id missing identifier->symbol identifier=?))
(cond [(eq? entry missing)
(id-table-set! who d id default identifier->symbol identifier=?)
default]
(if (procedure? default) (default) default)]
[else entry]))
(define (id-table-update/constructor who d id updater default constructor identifier->symbol identifier=?)