From 7e1c6001eb023ddb72e7b19569468d72efa785cd Mon Sep 17 00:00:00 2001 From: Abdulaziz Ghuloum Date: Sat, 17 Nov 2007 01:16:24 -0500 Subject: [PATCH] Fixes a bug in top-level set! that caused the following to signal an error: > (define foo 12) > (begin ((lambda (x) (set! foo x)) 13) 14) --- scheme/psyntax.expander.ss | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/scheme/psyntax.expander.ss b/scheme/psyntax.expander.ss index dec8a77..0bde871 100644 --- a/scheme/psyntax.expander.ss +++ b/scheme/psyntax.expander.ss @@ -2384,8 +2384,13 @@ (build-lexical-assignment no-source value (chi-expr v r mr))) - ((global core-prim) - (stx-error e "cannot modify imported identifier in")) + ((core-prim) + (stx-error e "cannot modify imported core primitive")) + ((global) + (let ((loc (gen-global-var-binding x e))) + (let ((rhs (chi-expr v r mr))) + (build-global-assignment no-source loc rhs)))) +; (stx-error e "cannot modify imported identifier in")) ((global-macro!) (chi-expr (chi-global-macro value e) r mr)) ((local-macro!)