bugThe CHICKEN Scheme-to-C compiler - Bugs: bug #8330, letrec may behave incorrectly in...

 
 

bug #8330: letrec may behave incorrectly in the presence of call/cc

Submitted by:  Category 5 <catfive>
Submitted on:  Sat 27 Mar 2004 04:24:03 PM UTC  
 
Category: NoneSeverity: 3 - Normal
Item Group: NoneStatus: None
Privacy: PublicAssigned to: Felix Winkelmann <flw>
Open/Closed: Closed

Add a New Comment(Rich Markup)
   

You are not logged in

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

 

Mon 29 Mar 2004 05:48:01 AM UTC, comment #1:

The standard behaviour can be selected by compiling/interpreting with the
`-strict-letrec' command-line option.

Felix Winkelmann <flw>
Project AdministratorIn charge of this item.
Sat 27 Mar 2004 04:24:03 PM UTC, original submission:

The following expression evaluates to #f in Chicken:

(letrec ((x (call/cc list)) (y (call/cc list)))
(if (procedure? x) (x (pair? y)))
(if (procedure? y) (y (pair? x)))
(let ((x-cont (car x)) (y-cont (car y)))
(and (call/cc x-cont) (call/cc y-cont) (call/cc x-cont))))

The first macro expansion is:

(let ((x (##core#undefined)) (y (##core#undefined)))
(begin
(##core#set! x (call/cc list))
(##core#set! y (call/cc list))
(begin
(if (procedure? x) (x (pair? y)))
(if (procedure? y) (y (pair? x)))
(let ((x-cont (car x)) (y-cont (car y)))
(and (call/cc x-cont)
(call/cc y-cont)
(call/cc x-cont))))))

The problem is that when (call/cc y-cont) is evaluated and control returns to the (set! y ...) the initial value of x is not restored.

This is explained in <40654679@news101.his.com> on comp.lang.scheme in the quoted message by Al* Petrofsky.

Category 5 <catfive>
Project Member

 

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

Attach File(s):
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

CC list is empty

 

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

Only logged-in users can vote.

 

Please enter the title of George Orwell's famous dystopian book (it's a date):

 

 

Follows 1 latest change.

Date Changed By Updated Field Previous Value => Replaced By
Mon 29 Mar 2004 05:48:01 AM UTCflwOpen/ClosedOpen=>Closed

Back to the top


Powered by Savane 3.1-cleanup1