diff options
author | Christopher Allan Webber <cwebber@dustycloud.org> | 2016-12-13 12:43:42 -0600 |
---|---|---|
committer | Christopher Allan Webber <cwebber@dustycloud.org> | 2016-12-13 12:43:42 -0600 |
commit | 711168a756750d8e8236c8549d8617c10ddcda58 (patch) | |
tree | 4d99b45f0f24a2f2ec0ef704d9c3a4c44289e037 | |
parent | 5d45fbc0fcecd2f635713af7d17f198fb4345433 (diff) | |
download | 8sync-remove-define-mhandler.tar.gz |
actors: Add msg-val and add docstring to msg-receive.remove-define-mhandler
* 8sync/systems/actors.scm (msg-receive): Add docstring, and change
parameter name from "the-message" to just "message".
(msg-val): New procedure.
-rw-r--r-- | 8sync/systems/actors.scm | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/8sync/systems/actors.scm b/8sync/systems/actors.scm index 7b47c5f..84a5c2e 100644 --- a/8sync/systems/actors.scm +++ b/8sync/systems/actors.scm @@ -70,7 +70,7 @@ <- <-wait <-reply <-reply-wait - call-with-message msg-receive + call-with-message msg-receive msg-val ez-run-hive bootstrap-message @@ -622,11 +622,20 @@ argument. Similar to call-with-values in concept." ;; Emacs: (put 'msg-receive 'scheme-indent-function 2) ;; @@: Or receive-msg or receieve-message or?? -(define-syntax-rule (msg-receive arglist the-message body ...) - (call-with-message the-message +(define-syntax-rule (msg-receive arglist message body ...) + "Call body with arglist (which can accept arguments like lambda*) +applied from the message-body of message." + (call-with-message message (lambda* arglist body ...))) +(define (msg-val message) + "Retrieve the first value from the message-body of message. +Like single value return from a procedure call. Probably the most +common case when waiting on a reply from some action invocation." + (call-with-message message + (lambda (_ val) val))) + ;;; Various API methods for actors to interact with the system ;;; ========================================================== |