From 0f7daa4787860cbbc739a51140fb8257b7fc4fef Mon Sep 17 00:00:00 2001 From: Christopher Allan Webber Date: Tue, 8 Aug 2017 15:43:14 -0500 Subject: [PATCH] Rename wrap -> live-wrap and use in websocket server module. * 8sync/actors.scm (live-wrap): Rename from `wrap' for clarity. (build-actions): Update call to `live-wrap'. * 8sync/systems/websocket/server.scm (): Re-wrap `websocket-client-loop' in `upgrade-paths' slot, now with `live-wrap'. --- 8sync/actors.scm | 8 ++++---- 8sync/systems/websocket/server.scm | 3 ++- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/8sync/actors.scm b/8sync/actors.scm index 62a07ac..a069a71 100644 --- a/8sync/actors.scm +++ b/8sync/actors.scm @@ -85,7 +85,7 @@ ;; Maybe the wrong place for this, or for it to be exported. ;; But it's used in websockets' server implementation at least... - wrap)) + live-wrap)) ;; For ids (set! *random-state* (random-state-from-platform)) @@ -223,18 +223,18 @@ #:message message)) (apply method actor message (message-body message))) -(define-syntax-rule (wrap body) +(define-syntax-rule (live-wrap body) "Wrap possibly multi-value function in a procedure, applies all arguments" (lambda args (apply body args))) (define-syntax-rule (build-actions (symbol method) ...) "Construct an alist of (symbol . method), where the method is wrapped -with `wrap' to facilitate live hacking and allow the method definition +with `live-wrap' to facilitate live hacking and allow the method definition to come after class definition." (build-rmeta-slot (list (cons (quote symbol) - (wrap method)) ...))) + (live-wrap method)) ...))) (define-class () ;; An address object... a vector of #(actor-id hive-id inbox-channel dead?) diff --git a/8sync/systems/websocket/server.scm b/8sync/systems/websocket/server.scm index 4751067..7a7526d 100644 --- a/8sync/systems/websocket/server.scm +++ b/8sync/systems/websocket/server.scm @@ -68,7 +68,8 @@ string." (define-actor () ((ws-send websocket-server-send)) - (upgrade-paths #:init-value `(("websocket" . ,websocket-client-loop)) + (upgrade-paths #:init-value `(("websocket" . + ,(live-wrap websocket-client-loop))) #:allocation #:each-subclass #:accessor .upgrade-paths) -- 2.31.1