WIP: Plan for straightening out metaevents
This commit is contained in:
parent
fdeb257d46
commit
dea5eeb3e9
20
os.rkt
20
os.rkt
|
@ -293,14 +293,16 @@
|
|||
#t]
|
||||
[_ #f]))
|
||||
|
||||
;; VTable ( -> KernelModeTransition ) -> Void
|
||||
;; (MessagePattern Message -> Boolean) ( -> KernelModeTransition ) -> Void
|
||||
;; In this context,
|
||||
;; Message = a thunk
|
||||
;; MessagePattern = evt?
|
||||
;; MetaMessage, MetaMessagePattern = not defined because there's no outer level
|
||||
;; Runs its argument VM until it becomes (provably) inert.
|
||||
(define (ground-vm vtable boot)
|
||||
(let loop ((transition (run-vm (make-vm vtable boot))))
|
||||
(define (ground-vm apply-message-pattern boot)
|
||||
(let loop ((transition (run-vm (make-vm (vtable apply-message-pattern
|
||||
match-ground-message)
|
||||
boot))))
|
||||
(when (not (nested-vm-inert? transition))
|
||||
(match transition
|
||||
[(kernel-mode-transition (subscription new-state
|
||||
|
@ -312,9 +314,17 @@
|
|||
'())
|
||||
(for-each (lambda (thunk) (thunk)) outbound-messages)
|
||||
(define inbound-messages
|
||||
(map (match-lambda [(message-handler e k) (wrap-evt e (lambda (v) (cons v k)))])
|
||||
(map (match-lambda [(message-handler e k) (wrap-evt e (lambda (v) (list v e k)))])
|
||||
message-handlers))
|
||||
(match-define (cons inbound-message-value inbound-message-continuation)
|
||||
(match-define (cons inbound-value inbound-evt inbound-continuation)
|
||||
;;
|
||||
;; Plan: make the processes metatalking to the ground-vm supply unique
|
||||
;; identifiers, and use those unique identifiers for matching up the
|
||||
;; specific events with specific event handlers. So when a
|
||||
;; metamessagepattern is built, use some constructor procedure to
|
||||
;; build an opaque metamessagepattern containing a unique ID; and when
|
||||
;; the incoming event comes in, label it with the appropriate ID.
|
||||
;;
|
||||
(apply sync
|
||||
(wrap-evt (if polling-k always-evt never-evt)
|
||||
(lambda (v) (cons (void)
|
||||
|
|
Loading…
Reference in New Issue