projects
/
8sync.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
actors: Fix export of pprint-message
[8sync.git]
/
8sync
/
systems
/
actors.scm
diff --git
a/8sync/systems/actors.scm
b/8sync/systems/actors.scm
index bd164be2c26199e1f2fa1a6730085dddd162e777..8477a2899e41bc93b04180fcd78d7b01072dc7e4 100644
(file)
--- a/
8sync/systems/actors.scm
+++ b/
8sync/systems/actors.scm
@@
-70,7
+70,11
@@
reply-message reply-message-wait
ez-run-hive
reply-message reply-message-wait
ez-run-hive
- hive-bootstrap-message))
+ hive-bootstrap-message
+
+ serialize-message write-message
+ serialize-message-pretty pprint-message
+ read-message read-message-from-string))
;; For ids
(define %random-state
;; For ids
(define %random-state
@@
-461,13
+465,22
@@
Instead, actors should call create-actor."
;; change), and using existing tooling (though adding new tooling
;; would be negligible in implementation effort.)
;; change), and using existing tooling (though adding new tooling
;; would be negligible in implementation effort.)
-(define* (message-ref message key #:optional dflt)
+;; This cons cell is immutable and unique (for eq? tests)
+(define %nothing-provided (cons 'nothing 'provided))
+
+(define* (message-ref message key #:optional (dflt %nothing-provided))
"Extract KEY from body of MESSAGE.
"Extract KEY from body of MESSAGE.
-Optionally set default with [DFLT]"
+Optionally set default with [DFLT]
+If key not found and DFLT not provided, throw an error."
(let ((result (assoc key (message-body message))))
(if result (cdr result)
(let ((result (assoc key (message-body message))))
(if result (cdr result)
- dflt)))
+ (if (eq? dflt %nothing-provided)
+ (throw 'message-missing-key
+ "Message body does not contain key and no default provided"
+ #:key key
+ #:message message)
+ dflt))))
(define (kwarg-list-to-alist args)
(define (kwarg-list-to-alist args)