From: Christopher Allan Webber Date: Sat, 30 Apr 2016 21:35:51 +0000 (-0500) Subject: actors: Add define-mhandler, a method handler definition tool. X-Git-Tag: v0.2.0~12 X-Git-Url: https://jxself.org/git/?a=commitdiff_plain;h=5099eea71d7271a4237855c7d297195f36251b01;p=8sync.git actors: Add define-mhandler, a method handler definition tool. * 8sync/systems/actors.scm (define-mhandler): New macro. --- diff --git a/8sync/systems/actors.scm b/8sync/systems/actors.scm index 8c4258d..a503313 100644 --- a/8sync/systems/actors.scm +++ b/8sync/systems/actors.scm @@ -47,7 +47,7 @@ actor-id-hive actor-id-string - mlambda + mlambda define-mhandler make-action-dispatch define-simple-actor @@ -334,6 +334,14 @@ Which is like doing manually: (let ((message-arg (message-ref message (quote message-arg))) ...) body body* ...))))) +;; @@: Sadly, docstrings won't work with this... +;; I think we need to bust out syntax-case to make that happen... +(define-syntax-rule (define-mhandler (name actor message message-arg ...) + body ...) + (define name + (mlambda (actor message message-arg ...) + body ...))) + (define (simple-dispatcher action-map) (lambda (actor message) (let* ((action (message-action message))