chicken-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Chicken-users] bug in let-optionals in 4.5.0?


From: Felix
Subject: Re: [Chicken-users] bug in let-optionals in 4.5.0?
Date: Mon, 05 Jul 2010 14:34:41 +0200 (CEST)

From: Alejandro Forero Cuervo <address@hidden>
Subject: [Chicken-users] bug in let-optionals in 4.5.0?
Date: Mon, 5 Jul 2010 00:33:58 +0200

> Now I'm stuck in another problem, it seems to be caused by a bug in
> let-optionals.  In Chicken 3.4.0, the following form evaluates to #f,
> as expected:
> 
>   (let-optionals '(#f) ((rest #f)) #f)
> 
> In Chicken 4.5.0, both csi and in compiled code, it yields an error:
> 
>   Error: too many optional arguments: #f
> 
> The following, however, works:
> 
>   (let-optionals '(#f) ((rest2 #f)) #f)
> 
> Does anybody use let-optionals?  Is this a known issue fixed in newer
> versions? It strikes me as surprising that such simple errors could go
> undetected.  Am I supposed to use some form other than let-optionals
> for the kind of thing it does?

This is caused by a bug in the implementation of `let-optionals'
(I inadvertently made two different temporaries have the same name).
A patch is attached - thanks for reporting this!


cheers,
felix
commit 853746f62769201a34abaa11585fa5e8b421ed58
Author: felix <address@hidden>
Date:   Mon Jul 5 14:31:45 2010 +0200

    fixed renaming bug in let-optionals (thanks to Alejandro Forero Cuervo)

diff --git a/chicken-syntax.scm b/chicken-syntax.scm
index 53a9545..80a1fe6 100644
--- a/chicken-syntax.scm
+++ b/chicken-syntax.scm
@@ -639,7 +639,7 @@
             (body-proc (r 'body))
 
             ;; A private var, bound to the value of the ARG-LIST expression.
-            (rest-var (r '%rest))
+            (rest-var (r '_%rest))
 
             (defaulter-names (map (lambda (var) (r (prefix-sym "def-" var)))
                                   vars))

reply via email to

[Prev in Thread] Current Thread [Next in Thread]