bugKawa - Bugs: bug #27042, Bad interaction between...


bug #27042: Bad interaction between syntax-rules and call-with-values

Submitted by:  Helmut Eller <ellerh>
Submitted on:  Thu 16 Jul 2009 05:53:09 PM UTC  
Category:  None Severity:  3 - Normal
Item Group:  None Status:  Fixed
Privacy:  Public Assigned to:  Per Bothner <bothner>
Open/Closed:  Closed

Add a New Comment (Rich Markup)

You are not logged in

Please log in, so followups can be emailed to you.


Sun 06 Dec 2009 01:13:46 AM UTC, comment #1:

Thanks for the bug report, and sorry for it taking so long!

If turned out to have nothing to do specifically with call-with-values - it actually was a bad interaction between syntax-rules and lambda. The following example showed the same problem:

(let-syntax ((dlet
(syntax-rules ()
;; var==x val==(+x 10) body==x
((dlet (var val) body)
(let ((saved var)) ; saved=0
(set! var val) ; x = 10
((lambda (result) ; result=10
(set! var result) ; x=10
(set! var saved) ; x=0
result) ; 10
(let ((x 0))
(display x)
(dlet (x (+ x 10))
(display x)

I tracked it down, and fixed it. Fix and test-case checked in.

Per Bothner <bothner>
Project AdministratorIn charge of this item.
Thu 16 Jul 2009 05:53:09 PM UTC, original submission:

This example

(let-syntax ((dlet
(syntax-rules ()
((dlet (var val) body)
(let ((saved var))
(set! var val)
(call-with-values (lambda () body)
(lambda (result)
(set! var saved)
(let ((x 0))
(list x
(dlet (x (+ x 10))

should return (0 10 0) but returns (0 10 10).
The intention of dlet is to temporarily rebind the variable.
Sorry, couldn't come up with a simpler expression.

If it helps: referencing var inside the second lambda, e.g. with
something like (set! var var), works around the problem.

Helmut Eller <ellerh>


(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:

No files currently attached


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by bothner (Posted a comment)
  • -email is unavailable- added by ellerh (Submitted the item)

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.




    Follow 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2009-12-06 bothner Assigned toNone => bothner
        Open/ClosedOpen => Closed
        StatusNone => Fixed

    Back to the top

    Powered by Savane 3.4