chicken-users
[Top][All Lists]
Advanced

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

Re: [Chicken-users] Dynamic wind problem in with-input-from-file


From: Alex Shinn
Subject: Re: [Chicken-users] Dynamic wind problem in with-input-from-file
Date: Tue, 20 Dec 2011 01:13:32 +0900

Hi,

As I explained on the Chibi list, this is not technically a bug:

The specification of with-input-from-file (in R5RS and R7RS)
states:

     If an escape procedure is used to escape from the
     continuation of these procedures, their behavior
     is implementation dependent.

Hence Chibi (and Chicken) get confused because they
implement it without dynamic-wind, and when you jump
out current-input-port is still bound to /etc/motd, where
it tries to continue the repl from.

Although this is not a violation of the standard, I've
updated Chibi to use dynamic-wind and do the right
thing here.

-- 
Alex

On Tue, Dec 20, 2011 at 12:40 AM,  <address@hidden> wrote:
> I tried the following:
>
> (define (ignore . args)
>  (if #f #f))
>
> (define (x)
>  (call-with-current-continuation
>   (lambda (return)
>     (with-input-from-file "/etc/motd"
>       (lambda ()
>         (return (ignore)))))))
>
> (ignore (x))
>
> This maks csi reading the contents of /etc/motd as source input:
>
> $ csi
>
> CHICKEN
> (c)2008-2011 The Chicken Team
> (c)2000-2007 Felix L. Winkelmann
> Version 4.7.0.3-st
> linux-unix-gnu-x86 [ manyargs dload ptables ]
> compiled 2011-12-09 on x (Linux)
>
> #;1> (define (ignore . args)
>  (if #f #f))
> #;2> (define (x)
>  (call-with-current-continuation
>   (lambda (return)
>     (with-input-from-file "/etc/motd"
>       (lambda ()
>         (return (ignore)))))))
> #;3> (ignore (x))
>
> Error: unbound variable:
> ------------------------------------------------------------------------------------------
>
> Error: unbound variable: Red
>
> Error: unbound variable: Hat
>
> Error: unbound variable: Enterprise
>
> Error: unbound variable: Linux
>
> Error: unbound variable: Client
>
> Error: unbound variable: release
> 5.5
>
> _______________________________________________
> Chicken-users mailing list
> address@hidden
> https://lists.nongnu.org/mailman/listinfo/chicken-users



reply via email to

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