From: Christopher Allan Webber Date: Fri, 22 Apr 2016 14:34:57 +0000 (-0500) Subject: actors: Switch out address objects for more-easily-serialized cons cells X-Git-Tag: v0.2.0~62 X-Git-Url: https://jxself.org/git/?a=commitdiff_plain;h=89dfbd6214e8e00bca235fd2974c0b343655d48f;p=8sync.git actors: Switch out address objects for more-easily-serialized cons cells This is maybe temporary. If we ever have canonical sexps as the general serialization format, or something like that, we might revert to a nicer structure. * 8sync/systems/actors.scm (
): Commented out. --- diff --git a/8sync/systems/actors.scm b/8sync/systems/actors.scm index 2d42897..0ae6e05 100644 --- a/8sync/systems/actors.scm +++ b/8sync/systems/actors.scm @@ -38,7 +38,9 @@ actor-hive actor-message-handler -
+ ;;; Commenting out the
type for now; + ;;; it may be back when we have better serializers + ;;
make-address address? address-actor-id address-hive-id @@ -108,7 +110,7 @@ ;;; ========================= (define-class () - ;; An
object + ;; An address object (id #:init-thunk (require-slot "id") #:init-keyword #:id #:getter actor-id) @@ -124,17 +126,31 @@ (define-method (actor-message-handler (actor )) (slot-ref actor 'message-handler)) -(define-record-type
- (make-address actor-id hive-id) ; @@: Do we want the trailing -id? - address? - (actor-id address-actor-id) - (hive-id address-hive-id)) - -(set-record-type-printer! -
- (lambda (record port) - (format port "" - (address-actor-id record) (address-hive-id record)))) +;;; So these are the nicer representations of addresses. +;;; However, they don't serialize so easily with scheme read/write, so we're +;;; using the simpler cons cell version below for now. + +;; (define-record-type
+;; (make-address actor-id hive-id) ; @@: Do we want the trailing -id? +;; address? +;; (actor-id address-actor-id) +;; (hive-id address-hive-id)) +;; +;; (set-record-type-printer! +;;
+;; (lambda (record port) +;; (format port "" +;; (address-actor-id record) (address-hive-id record)))) +;; + +(define (make-address actor-id hive-id) + (cons actor-id hive-id)) + +(define (address-actor-id address) + (car address)) + +(define (address-hive-id address) + (cdr address)) (define (address->string address) (string-append (address-actor-id address) "@"