unofficial mirror of bug-guile@gnu.org 
 help / color / mirror / Atom feed
* bug#39811: Missing dynwind exit application
@ 2020-02-27 18:59 Stefan Israelsson Tampe
  2020-03-03 20:33 ` Andy Wingo
  0 siblings, 1 reply; 2+ messages in thread
From: Stefan Israelsson Tampe @ 2020-02-27 18:59 UTC (permalink / raw)
  To: 39811

[-- Attachment #1: Type: text/plain, Size: 762 bytes --]

Executing this code on guile-3.0.0:

(dynamic-wind
 (lambda () (pk 'enter))
 (lambda () (catch #t
              (lambda () (throw 1))
              (lambda x (pk 'catch x) (apply throw x))))
 (lambda () (pk 'leave)))

Leads to the output:

scheme@(guile-user)> (load "bug.scm")
;;; (enter)
;;; (catch (a))

ice-9/boot-9.scm:1669:16: In procedure raise-exception:
Throw to key `a' with args `()'.

What, it does not execute the leave part of the dynamic wind.

This works however,

(catch #t
  (lambda ()
    (dynamic-wind
      (lambda () (pk 'enter))
      (lambda () (catch #t
                   (lambda () (throw 'a))
                   (lambda x (pk 'catch x) (apply throw x))))
      (lambda () (pk 'leave))))
  (lambda x #f))

So is this how it should be?

[-- Attachment #2: Type: text/html, Size: 1371 bytes --]

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

* bug#39811: Missing dynwind exit application
  2020-02-27 18:59 bug#39811: Missing dynwind exit application Stefan Israelsson Tampe
@ 2020-03-03 20:33 ` Andy Wingo
  0 siblings, 0 replies; 2+ messages in thread
From: Andy Wingo @ 2020-03-03 20:33 UTC (permalink / raw)
  To: Stefan Israelsson Tampe; +Cc: 39811-close

Stefan Israelsson Tampe <stefan.itampe@gmail.com> writes:

> Executing this code on guile-3.0.0:
>
> (dynamic-wind
>  (lambda () (pk 'enter))
>  (lambda () (catch #t
>               (lambda () (throw 1))
>               (lambda x (pk 'catch x) (apply throw x))))
>  (lambda () (pk 'leave)))
>
> Leads to the output:
>
> scheme@(guile-user)> (load "bug.scm") 
> ;;; (enter) 
> ;;; (catch (a)) 
>
> ice-9/boot-9.scm:1669:16: In procedure raise-exception: 
> Throw to key `a' with args `()'. 
>
> What, it does not execute the leave part of the dynamic wind.

That is because the REPL leaves you in the context of where the uncaught
error was thrown.  If you ,quit the REPL to go back to the outer REPL,
it will print "leave" as expected.  Please reopen if I have
misunderstood :)

Cheers,

Andy





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

end of thread, other threads:[~2020-03-03 20:33 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-27 18:59 bug#39811: Missing dynwind exit application Stefan Israelsson Tampe
2020-03-03 20:33 ` 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).