From eb208f3a10ddad8f10bb0c3c7f8503e85956ded1 Mon Sep 17 00:00:00 2001 From: Tony Garnock-Jones Date: Tue, 1 May 2018 22:39:50 +0100 Subject: [PATCH] Handy logging for diagnosing problems --- syndicate/dataspace.rkt | 4 ++++ syndicate/relay.rkt | 5 +++++ syndicate/syntax.rkt | 8 ++++++++ 3 files changed, 17 insertions(+) diff --git a/syndicate/dataspace.rkt b/syndicate/dataspace.rkt index ebb6a57..6e905c1 100644 --- a/syndicate/dataspace.rkt +++ b/syndicate/dataspace.rkt @@ -281,6 +281,8 @@ (define-syntax-rule (with-current-facet [f0] body ...) (let ((f f0)) + ;; (when (not f) + ;; (error 'with-current-facet "Cannot use with-current-facet this way")) (parameterize ((current-facet f)) (with-handlers ([(lambda (e) (not (exn:break? e))) (lambda (e) @@ -299,6 +301,8 @@ (define (capture-facet-context proc) (let ((f (current-facet))) + ;; (when (not f) + ;; (error 'capture-facet-context "Cannot capture non-facet")) (lambda args (with-current-facet [f] (apply proc args))))) diff --git a/syndicate/relay.rkt b/syndicate/relay.rkt index 6dbfa1e..549ff1a 100644 --- a/syndicate/relay.rkt +++ b/syndicate/relay.rkt @@ -75,6 +75,11 @@ (term->capture-proj x) (lambda (op . captured-values) (define term (inbound (instantiate-term->value x captured-values))) + ;; (log-info "~a => ~a ~a ~v" + ;; outer-facet + ;; inner-facet + ;; op + ;; term) (push-script! inner-actor (lambda () ;; (log-info "~a (~a) ~v" inner-actor op term) diff --git a/syndicate/syntax.rkt b/syndicate/syntax.rkt index 3c8f521..1b39580 100644 --- a/syndicate/syntax.rkt +++ b/syndicate/syntax.rkt @@ -323,6 +323,10 @@ (capture-facet-context (lambda (op #,@(desc->capture-names desc)) (when (eq? op '!) + ;; (log-info "~a ~a ~v" + ;; (current-facet) + ;; op + ;; (list #,@(desc->capture-names desc))) (schedule-script! #:priority #,priority-stx (current-actor) @@ -370,6 +374,10 @@ (capture-facet-context (lambda (op #,@(desc->capture-names desc)) (when (eq? op #,(if asserted? #''+ #''-)) + ;; (log-info "~a ~a ~v" + ;; (current-facet) + ;; op + ;; (list #,@(desc->capture-names desc))) (schedule-script! #:priority #,priority-stx (current-actor)