From 8717cc8a8194b41854d611372274f9a342b400e9 Mon Sep 17 00:00:00 2001 From: sam Date: Wed, 24 Sep 2003 16:32:46 +0000 Subject: [PATCH] * Fixed scope of named let variables, fixing the bug described here: http://groups.google.com/groups?selm=871zemtmd4.fsf%40app.dial.idiom.com git-svn-id: svn://svn.zoy.org/elk/trunk@185 55e467fa-43c5-0310-a8a2-de718669efc6 --- BUGS | 3 --- src/special.c | 7 ++++++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/BUGS b/BUGS index f59a715..6dea7af 100644 --- a/BUGS +++ b/BUGS @@ -36,7 +36,4 @@ Generational/Incremental Garbage Collector o The percentage displayed at the end of a GC run is sometimes wrong. - o The scope of the name of a named let is wrong, as explained in - http://groups.google.com/groups?selm=871zemtmd4.fsf%40app.dial.idiom.com - o Almost no Unix commands work under Win32, and they are badly disabled. diff --git a/src/special.c b/src/special.c index b90f192..c40c5ce 100644 --- a/src/special.c +++ b/src/special.c @@ -456,6 +456,7 @@ Object Named_Let (Object argl) { (void)P_Set_Cdr (vtail, cell); vtail = cell; } + /* Create a new environment to protect our named let variable */ Push_Frame (Add_Binding (Null, Car (argl), Null)); tail = Cons (vlist, Cdr (Cdr (argl))); if (Nullp (Cdr (tail))) @@ -466,8 +467,12 @@ Object Named_Let (Object argl) { Cdr (b) = tail; SYMBOL(Car (argl))->value = tail; TC_Enable; - tail = Funcall (tail, flist, 1); + /* Restore environment before calling the function */ Pop_Frame (); + /* vlist: list of variables + * flist: list of initial values + * tail: our new lambda function */ + tail = Funcall (tail, flist, 1); GC_Unlink; return tail; }