Simplify during*

This commit is contained in:
Tony Garnock-Jones 2021-06-10 14:41:57 +02:00
parent 2f4525b031
commit b5c57381fa
1 changed files with 5 additions and 14 deletions

View File

@ -239,23 +239,14 @@
(entity #:name name (entity #:name name
#:assert #:assert
(lambda (value handle) (lambda (value handle)
(let ((facet (react (facet-prevent-inert-check! this-facet) (hash-set! assertion-map
(f value)))) handle
(match (hash-ref assertion-map handle #f) (react (facet-prevent-inert-check! this-facet)
[#f (f value))))
(hash-set! assertion-map handle facet)]
['dead
(hash-remove! assertion-map handle)
(stop-facet facet)]
[_
(error 'during "Duplicate assertion handle ~a" handle)])))
#:retract #:retract
(lambda (handle) (lambda (handle)
(match (hash-ref assertion-map handle #f) (match (hash-ref assertion-map handle #f)
[#f [#f (void)]
(hash-set! assertion-map handle 'dead)]
['dead
(error 'during "Duplicate retraction handle ~a" handle)]
[facet [facet
(hash-remove! assertion-map handle) (hash-remove! assertion-map handle)
(stop-facet facet)])))) (stop-facet facet)]))))