From: Christopher Allan Webber Date: Mon, 25 Apr 2016 16:59:31 +0000 (-0500) Subject: actors: Remove nesting of actions in define-simple-actor. X-Git-Tag: v0.2.0~45 X-Git-Url: https://jxself.org/git/?a=commitdiff_plain;h=674056fde0ebfc4454485a8776ecb9efd9c3af8f;p=8sync.git actors: Remove nesting of actions in define-simple-actor. * 8sync/systems/actors.scm (define-simple-actor): Move actions out of the "final parenthesis". Simple actors just have a class type and then the rest of the arguments are acitons. * demos/actors/simplest-possible.scm: Remove unnecessary import of (ice-9 match). (, ): Adjust to new syntax for define-simple-actor. --- diff --git a/8sync/systems/actors.scm b/8sync/systems/actors.scm index 87d29ec..ce55597 100644 --- a/8sync/systems/actors.scm +++ b/8sync/systems/actors.scm @@ -349,7 +349,7 @@ more compact following syntax: (simple-dispatcher (list (%expand-action-item action-item) ...))))) -(define-syntax-rule (define-simple-actor class (actions ...)) +(define-syntax-rule (define-simple-actor class actions ...) (define-class class () (message-handler #:init-value (make-action-dispatch actions ...) diff --git a/demos/actors/simplest-possible.scm b/demos/actors/simplest-possible.scm index 1cd00ea..6c97159 100644 --- a/demos/actors/simplest-possible.scm +++ b/demos/actors/simplest-possible.scm @@ -17,25 +17,25 @@ ;;; License along with 8sync. If not, see . (use-modules (8sync systems actors) - (ice-9 match) (oop goops)) (define-simple-actor - ((greet-proog - (lambda (actor message) - (display "Heya Proog!\n") - (send-message - actor (message-ref message 'target) - 'greet-emo))))) + (greet-proog + (lambda (actor message) + (display "Heya Proog!\n") + (send-message + actor (message-ref message 'target) + 'greet-emo)))) (define-simple-actor - ((greet-emo - (lambda (actor message) - (display "Hi, Emo!\n"))))) + (greet-emo + (lambda (actor message) + (display "Hi, Emo!\n")))) (define hive (make-hive)) (define our-emo (hive-create-actor hive )) (define our-proog (hive-create-actor hive )) -(ez-run-hive hive - (list (hive-bootstrap-message hive our-emo 'greet-proog - #:target our-proog))) +(define (run-demo) + (ez-run-hive hive + (list (hive-bootstrap-message hive our-emo 'greet-proog + #:target our-proog))))