Repair during macro; use during in box/client example

This commit is contained in:
Tony Garnock-Jones 2021-06-03 16:03:00 +02:00
parent 4b1b2a9635
commit 6b3988caf7
2 changed files with 4 additions and 22 deletions

View File

@ -32,30 +32,12 @@
(define client
(action (ds)
(spawn (define root-facet this-facet)
(define count 0)
(at ds
(when (asserted (BoxState $value))
(send! ds (SetBox->preserves (SetBox (+ value 1)))))
;; (during (BoxState _)
;; (on-start (set! count (+ count 1)))
;; (on-stop (set! count (- count 1))
;; (when (zero? count)
;; (log-info "Client detected box termination")
;; (stop-facet root-facet))))
(assert (Observe (:pattern (BoxState _))
(ref (entity #:assert
(action (_v _h)
(set! count (+ count 1)))
#:retract
(action (_h)
(set! count (- count 1))
(when (zero? count)
(log-info "Client detected box termination")
(stop-facet root-facet)))))))
;; (during (BoxState _)
;; (on-stop (log-info "Client detected box termination")
;; (stop-facet root-facet)))
))))
(during (BoxState _)
(on-stop (log-info "Client detected box termination")
(stop-facet root-facet)))))))
(module+ main
(time

View File

@ -166,7 +166,7 @@
(ref (let ((assertion-map (make-hash)))
(entity #:assert
(action (bindings handle)
(match-define (list #,(analyse-pattern-bindings #'pat)) bindings)
(match-define (list #,@(analyse-pattern-bindings #'pat)) bindings)
(let ((facet (react
(facet-prevent-inert-check! this-facet)
expr ...)))