projects
/
8sync.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
actors: Add with-message-args and build mlambda off it.
[8sync.git]
/
8sync
/
systems
/
actors.scm
diff --git
a/8sync/systems/actors.scm
b/8sync/systems/actors.scm
index a5033135653422a8c8feb7db452a766fe9288d4c..270b25f452909e5a000780bd7de5e968d47d63d2 100644
(file)
--- a/
8sync/systems/actors.scm
+++ b/
8sync/systems/actors.scm
@@
-316,6
+316,12
@@
If key not found and DFLT not provided, throw an error."
;;; Actor utilities
;;; ===============
;;; Actor utilities
;;; ===============
+
+(define-syntax-rule (with-message-args (message message-arg ...)
+ body body* ...)
+ (let ((message-arg (message-ref message (quote message-arg))) ...)
+ body body* ...))
+
(define-syntax mlambda
(syntax-rules ()
"A lambda for building message handlers.
(define-syntax mlambda
(syntax-rules ()
"A lambda for building message handlers.
@@
-331,8
+337,7
@@
Which is like doing manually:
((_ (actor message message-arg ...)
body body* ...)
(lambda (actor message)
((_ (actor message message-arg ...)
body body* ...)
(lambda (actor message)
- (let ((message-arg (message-ref message (quote message-arg))) ...)
- body body* ...)))))
+ (with-message-args (message message-arg ...) body body* ...)))))
;; @@: Sadly, docstrings won't work with this...
;; I think we need to bust out syntax-case to make that happen...
;; @@: Sadly, docstrings won't work with this...
;; I think we need to bust out syntax-case to make that happen...