message-struct and assertion-struct
This commit is contained in:
parent
6a436f4c12
commit
516f6a5cd2
|
@ -11,6 +11,9 @@
|
|||
|
||||
(struct-out process)
|
||||
|
||||
assertion-struct
|
||||
message-struct
|
||||
|
||||
(struct-out seal)
|
||||
sealof
|
||||
|
||||
|
@ -116,6 +119,12 @@
|
|||
;; A PID is a Nat.
|
||||
;; A Label is a PID or 'meta.
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; Thin veneers over `struct` for declaring intent.
|
||||
|
||||
(define-syntax-rule (assertion-struct item ...) (struct item ... #:prefab))
|
||||
(define-syntax-rule (message-struct item ...) (struct item ... #:prefab))
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; Seals are used by protocols to prevent the routing tries from
|
||||
;; examining internal structure of values.
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
#lang syndicate
|
||||
;; Simple mutable box and count-to-infinity box client.
|
||||
|
||||
(struct set-box (new-value) #:transparent)
|
||||
(struct box-state (value) #:transparent)
|
||||
(message-struct set-box (new-value))
|
||||
(assertion-struct box-state (value))
|
||||
|
||||
(spawn (field [current-value 0])
|
||||
(assert (box-state (current-value)))
|
||||
|
|
Loading…
Reference in New Issue