From: Christopher Allan Webber Date: Sat, 17 Dec 2016 00:20:28 +0000 (-0600) Subject: actors: Adding "mhandlers" and updating define-simple-actor to use it. X-Git-Tag: v0.3.0~5 X-Git-Url: https://jxself.org/git/?a=commitdiff_plain;h=47dbaac681252f3d71e78a712cab0c829b913a63;p=8sync.git actors: Adding "mhandlers" and updating define-simple-actor to use it. We also mark a whole range of abstractions as deprecated, but those will be removed as they're phased out of use. * 8sync/systems/actors.scm (mhandlers): New macro. (define-simple-actor): Update to use mhandlers. --- diff --git a/8sync/systems/actors.scm b/8sync/systems/actors.scm index 52b1877..ce23bfa 100644 --- a/8sync/systems/actors.scm +++ b/8sync/systems/actors.scm @@ -53,6 +53,8 @@ simple-dispatcher build-actions make-action-dispatch define-simple-actor + mhandlers + make-hive ;; There are more methods for the hive, but there's @@ -323,6 +325,8 @@ ;;; Actor utilities ;;; =============== +;;;;;;;;;;; Deprecated abstractions start here ;;;;;;;;;;; + (define (simple-dispatcher action-map) (lambda (actor message) (let* ((action (message-action message)) @@ -375,11 +379,21 @@ more compact following syntax: ((make-action-dispatch action-item ...) (simple-dispatcher (build-actions action-item ...))))) -(define-syntax-rule (define-simple-actor class actions ...) +;;;;;;;;;;; Deprecated abstractions end here ;;;;;;;;;;; + + +(define-syntax-rule (mhandlers (symbol method) ...) + "Construct an alist of (symbol . method), where the method is wrapped +with wrap-apply to facilitate live hacking and allow the method definition +to come after class definition." + (list + (cons (quote symbol) + (wrap-apply method)) ...)) + +(define-syntax-rule (define-simple-actor class action ...) (define-class class () - (message-handler - #:init-value (make-action-dispatch actions ...) - #:allocation #:each-subclass))) + (actions #:init-value (mhandlers action ...) + #:allocation #:each-subclass))) ;;; The Hive