From 6d8ced489c238f7b717101caf8eb37a5081039e0 Mon Sep 17 00:00:00 2001 From: Tony Garnock-Jones Date: Mon, 20 Feb 2017 17:04:39 -0500 Subject: [PATCH] Accept toplevel action-producing expressions yielding 0 values. A recent change to Racket must have changed the way `for` expands, because now in conjunction with `local-expand`, we see *effectively* a `(begin (values) (void))`. This isn't a problem usually, but in `#lang syndicate`'s `module-begin` context, we split apart `begin`s and examine their constituents, leading to examination of something that will ultimately yield 0 values. The change accepts either 0 or 1 values when collecting actions for the module's main boot actor to execute. More than 1 value yielded by such an expression is still considered an error. Currently, it gives unhelpful error location information; a future refinement might be to make the error reporting for this (rare) situation more helpful. --- racket/syndicate/actor.rkt | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/racket/syndicate/actor.rkt b/racket/syndicate/actor.rkt index c32e32c..8925048 100644 --- a/racket/syndicate/actor.rkt +++ b/racket/syndicate/actor.rkt @@ -1180,9 +1180,14 @@ (with-store [(current-pending-actions '()) (current-pending-patch patch-empty) (current-action-transformer values)] - (define result (thunk)) - (flush-pending-patch!) - (cons result (current-pending-actions)))))) + (call-with-values thunk + (lambda results + (flush-pending-patch!) + (when (> (length results) 1) + (error 'capture-actor-actions + "~a values supplied in top-level Syndicate action; more than one is unacceptable" + (length results))) + (cons results (current-pending-actions)))))))) (module+ for-module-begin (provide capture-actor-actions))