message-struct and assertion-struct

This commit is contained in:
Tony Garnock-Jones 2017-09-13 19:08:01 +01:00
parent 6a436f4c12
commit 516f6a5cd2
2 changed files with 11 additions and 2 deletions

View File

@ -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.

View File

@ -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)))