Simplify and rename %%boot to actor-body->spawn-action

This commit is contained in:
Tony Garnock-Jones 2015-12-12 07:02:13 +13:00
parent 97dceedff2
commit edaf97ae05
4 changed files with 75 additions and 83 deletions

View File

@ -17,7 +17,7 @@
;; forall
%%boot
actor-body->spawn-action
;;----------------------------------------
(struct-out actor-state)
@ -330,9 +330,9 @@
(script-complete-instruction new-variables)))))
(void))))
(define (%%boot thunk)
(define (actor-body->spawn-action thunk)
(match ((reply-to (lambda (dummy)
(thunk)
(actor (thunk))
(error '%%boot "Reached end of boot thunk")))
(void))
[(spawn-instruction 'actor action-fn _get-next-instr)

View File

@ -6,10 +6,8 @@
(struct set-box (new-value) #:transparent)
(struct box-state (value) #:transparent)
(%%boot
(actor-body->spawn-action
(lambda ()
(actor
(actor (forever #:collect [(current-value 0)]
(assert (box-state current-value))
(on (message (set-box $new-value))
@ -19,4 +17,4 @@
(actor (forever (on (asserted (box-state $v))
(log-info "client: learned that box's value is now ~v" v)
(send! (set-box (+ v 1))))))
)))
))

View File

@ -34,16 +34,11 @@
(send! (shutdown))
(send! (says user input-string)))))))
(%%boot
(actor-body->spawn-action
(lambda ()
(actor
(perform-core-action! (spawn-tcp-driver))
(network (define us (tcp-listener 5000))
(until (message (shutdown))
(assert (advertise (observe (tcp-channel _ us _))) #:meta-level 1)
(on (asserted (advertise (tcp-channel $them us _)) #:meta-level 1)
(spawn-session them us))))
)))
(spawn-session them us))))))

View File

@ -10,9 +10,8 @@
(struct save (file) #:prefab)
(struct delete (name) #:prefab)
(%%boot
(actor-body->spawn-action
(lambda ()
(actor
(perform-core-action! (spawn-timer-driver))
@ -71,4 +70,4 @@
(sleep 0.1)
(print-prompt)))))
)))
))