update field declaration syntax to match full impl
This commit is contained in:
parent
88f515a98f
commit
da422ff117
|
@ -42,7 +42,7 @@
|
||||||
;; + * / - and or not equal? null? car cdr printf
|
;; + * / - and or not equal? null? car cdr printf
|
||||||
|
|
||||||
;; an `O` (endpoint) is either
|
;; an `O` (endpoint) is either
|
||||||
;; ('field var exp) or
|
;; ('field [var exp] ...) or
|
||||||
;; ('assert exp) or
|
;; ('assert exp) or
|
||||||
;; ('on E exp ...) or
|
;; ('on E exp ...) or
|
||||||
;; ('stop-when E exp ...) or
|
;; ('stop-when E exp ...) or
|
||||||
|
@ -180,7 +180,7 @@
|
||||||
(define (run-endpoint O π-old σ Γ e)
|
(define (run-endpoint O π-old σ Γ e)
|
||||||
(match O
|
(match O
|
||||||
;; event-insensitive endpoints
|
;; event-insensitive endpoints
|
||||||
[`(field ,_ ,_)
|
[`(field ,_)
|
||||||
(inj-result #f σ)]
|
(inj-result #f σ)]
|
||||||
[`(on-start ,exp ...)
|
[`(on-start ,exp ...)
|
||||||
(inj-result #f σ)]
|
(inj-result #f σ)]
|
||||||
|
@ -216,7 +216,7 @@
|
||||||
;; IGNORE effects from such expressions (yadda yadda evil yadda yadda)
|
;; IGNORE effects from such expressions (yadda yadda evil yadda yadda)
|
||||||
(define (endpoint-assertions O Γ σ)
|
(define (endpoint-assertions O Γ σ)
|
||||||
(match O
|
(match O
|
||||||
[`(field ,_ ,_)
|
[`(field ,_)
|
||||||
trie-empty]
|
trie-empty]
|
||||||
[`(on-start ,exp ...)
|
[`(on-start ,exp ...)
|
||||||
trie-empty]
|
trie-empty]
|
||||||
|
@ -481,11 +481,15 @@
|
||||||
[bindings mt-Γ])
|
[bindings mt-Γ])
|
||||||
([o (in-list O)])
|
([o (in-list O)])
|
||||||
(match o
|
(match o
|
||||||
[`(field ,id ,exp)
|
[`(field (,ids ,exps) ...)
|
||||||
(match-define (continue v _ _ _) (eval-exp exp Γ σ))
|
(for/fold ([locations locations]
|
||||||
(values (cons (cons id v) locations)
|
[bindings bindings])
|
||||||
(cons (binding id (field-function id))
|
([id (in-list ids)]
|
||||||
bindings))]
|
[exp (in-list exps)])
|
||||||
|
(match-define (continue v _ _ _) (eval-exp exp Γ σ))
|
||||||
|
(values (cons (cons id v) locations)
|
||||||
|
(cons (binding id (field-function id))
|
||||||
|
bindings)))]
|
||||||
[_ (values locations bindings)])))
|
[_ (values locations bindings)])))
|
||||||
(values (apply make-store locations)
|
(values (apply make-store locations)
|
||||||
bindings))
|
bindings))
|
||||||
|
@ -807,7 +811,7 @@
|
||||||
|
|
||||||
(define bank-account
|
(define bank-account
|
||||||
`(
|
`(
|
||||||
(actor (react (field balance 0)
|
(actor (react (field [balance 0])
|
||||||
(assert (list "account" (balance)))
|
(assert (list "account" (balance)))
|
||||||
(on (message (list "deposit" $amount))
|
(on (message (list "deposit" $amount))
|
||||||
(balance (+ (balance) amount)))))
|
(balance (+ (balance) amount)))))
|
||||||
|
@ -896,9 +900,9 @@
|
||||||
;; should this work?
|
;; should this work?
|
||||||
(define store-passing
|
(define store-passing
|
||||||
'(
|
'(
|
||||||
(actor (react (field x 10)
|
(actor (react (field [x 10])
|
||||||
(on (message "spawn")
|
(on (message "spawn")
|
||||||
(actor (react (field y (+ 1 (x)))
|
(actor (react (field [y (+ 1 (x))])
|
||||||
(on (message "read y")
|
(on (message "read y")
|
||||||
(send! (list "y" (y)))))))
|
(send! (list "y" (y)))))))
|
||||||
(on (message "read x")
|
(on (message "read x")
|
||||||
|
@ -947,8 +951,8 @@
|
||||||
(module+ test
|
(module+ test
|
||||||
;; this should bring down the actor *but not* the entire program
|
;; this should bring down the actor *but not* the entire program
|
||||||
(define escaping-field
|
(define escaping-field
|
||||||
'((actor (react (field x #f)
|
'((actor (react (field [x #f])
|
||||||
(on-start (react (field y 10)
|
(on-start (react (field [y 10])
|
||||||
(on-start (x (lambda (v) (y v)))))
|
(on-start (x (lambda (v) (y v)))))
|
||||||
((x) 5)
|
((x) 5)
|
||||||
(send! "success!"))))))
|
(send! "success!"))))))
|
||||||
|
|
Loading…
Reference in New Issue