From 73ba69a633c63de7ef8344e10fba027102d1f245 Mon Sep 17 00:00:00 2001 From: Andy Wingo Date: Sun, 27 Oct 2013 11:40:55 +0100 Subject: [PATCH] Dynamic-wind doesn't call thunk? on the out-guard. * module/ice-9/boot-9.scm (dynamic-wind): Remove the thunk? check of the out-guard. --- module/ice-9/boot-9.scm | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/module/ice-9/boot-9.scm b/module/ice-9/boot-9.scm index 87c38af8a..83e5480d2 100644 --- a/module/ice-9/boot-9.scm +++ b/module/ice-9/boot-9.scm @@ -274,10 +274,20 @@ x a-cont @result{} special-binding @end lisp" - (if (thunk? out) - (in) - (scm-error 'wrong-type-arg "dynamic-wind" "Not a thunk: ~S" - (list out) #f)) + ;; FIXME: Here we don't check that the out procedure is a thunk before + ;; calling the in-guard, as dynamic-wind is called as part of loading + ;; modules, but thunk? requires loading (system vm debug). This is in + ;; contrast to the open-coded version of dynamic-wind, which does + ;; currently insert an eager thunk? check (but often optimizes it + ;; out). Not sure what the right thing to do is here -- make thunk? + ;; callable before modules are loaded, live with this inconsistency, + ;; or remove the thunk? check from the compiler? Questions, + ;; questions. + #; + (unless (thunk? out) + (scm-error 'wrong-type-arg "dynamic-wind" "Not a thunk: ~S" + (list out) #f)) + (in) ((@@ primitive wind) in out) (call-with-values thunk (lambda vals