[Top][All Lists]

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

exit & dynamic wind

From: Ian Price
Subject: exit & dynamic wind
Date: Tue, 22 Mar 2011 13:26:55 +0000

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

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

  (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
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 ;).


reply via email to

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