unofficial mirror of bug-guile@gnu.org 
 help / color / mirror / Atom feed
* exit & dynamic wind
@ 2011-03-22 13:26 Ian Price
  2011-03-24 19:23 ` Andy Wingo
  0 siblings, 1 reply; 11+ messages in thread
From: Ian Price @ 2011-03-22 13:26 UTC (permalink / raw)
  To: bug-guile

Hey guilers,

If you run (exit) at the repl, it is caught, and any after-thunks from
dynamic-wind will be called when you continue with ,q . However, in a
guile script, it is not an error, and the after-thunks are not
called.

$ cat Desktop/dynamic-wind-test.ss
#!r6rs
(import (rnrs))

(dynamic-wind
  (lambda () #f)
  (lambda () (exit 0))
  (lambda () (display "Exiting dynamic wind...\n")))
$ ikarus --r6rs-script Desktop/dynamic-wind-test.ss
$ mosh Desktop/dynamic-wind-test.ss
$ larceny -r6rs -program Desktop/dynamic-wind-test.ss
$ guile -s Desktop/dynamic-wind-test.ss
$ racket --script Desktop/dynamic-wind-test.ss
$ guile
GNU Guile 2.0.0.119-95c1c
Copyright (C) 1995-2011 Free Software Foundation, Inc.

Guile comes with ABSOLUTELY NO WARRANTY; for details type `,show w'.
This program is free software, and you are welcome to redistribute it
under certain conditions; type `,show c' for details.

Enter `,help' for help.
scheme@(guile-user)> (dynamic-wind
  (lambda () #f)
  (lambda () (exit 0))
  (lambda () (display "Exiting dynamic wind...\n")))
<unnamed port>:2:13: In procedure #<procedure a46e9b0 at <current
input>:1:0 ()>:
<unnamed port>:2:13: Throw to key `quit' with args `(0)'.

Entering a new prompt.  Type `,bt' for a backtrace or `,q' to continue.
scheme@(guile-user) [1]> ,q
Exiting dynamic wind...

What I think should probably happen, is that the (exit) should not be
caught at the repl, but that the after thunks should be called in both
cases (but not if you used primitive-exit or similar). As you can see
from the transcript, this is not the popular choice among scheme
implementers ;).

Thanks,
Ian



^ permalink raw reply	[flat|nested] 11+ messages in thread
* Re: exit & dynamic wind
@ 2011-03-30 19:06 Mike Gran
  2011-03-30 21:28 ` Andy Wingo
  0 siblings, 1 reply; 11+ messages in thread
From: Mike Gran @ 2011-03-30 19:06 UTC (permalink / raw)
  To: Neil Jerram, Andy Wingo; +Cc: bug-guile@gnu.org, Ian Price, guile-devel



----- Original Message -----
> From:Neil Jerram <neil@ossau.uklinux.net>
> To:Andy Wingo <wingo@pobox.com>
> Cc:bug-guile@gnu.org; Ian Price <ianprice90@googlemail.com>; guile-devel <guile-devel@gnu.org>
> Sent:Wednesday, March 30, 2011 11:31 AM
> Subject:Re: exit & dynamic wind
> 
> Andy Wingo <wingo@pobox.com> writes:
> 
> >>> |  GEN    guile-procedures.texi
> >>> | guile: uncaught throw to wrong-type-arg: (#f Wrong type 
> (expecting ~A): ~S (exact integer (#t #<catch-closure 9916c10> 
> #<catch-closure 9916be0>)) ((#t #<catch-closure 9916c10> 
> #<catch-closure 9916be0>)))
> >
> > This, it turns out, was something more pernicious, fixed in
> > 572eef50c2d902d34427945dd504ba03af666e48.
> 
> Thanks for the fix.  I'm afraid I struggled to understand the change,
> though - although I admit it may be largely my fault, as I'm not up to
> speed with VM or prompt internals.  Nevertheless, would it perhaps be
> worth a bit more commenting or a test, for future readers?

This likely closes out bug 32340, by the way.

-Mike



^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2011-03-30 21:54 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-03-22 13:26 exit & dynamic wind Ian Price
2011-03-24 19:23 ` Andy Wingo
2011-03-25  1:52   ` Neil Jerram
2011-03-25 16:45     ` Andy Wingo
2011-03-30 10:45       ` Andy Wingo
2011-03-30 18:31         ` Neil Jerram
2011-03-30 21:25           ` Andy Wingo
2011-03-30 21:43             ` Andy Wingo
2011-03-30 21:54             ` Neil Jerram
  -- strict thread matches above, loose matches on Subject: below --
2011-03-30 19:06 Mike Gran
2011-03-30 21:28 ` Andy Wingo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).