unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
From: Neil Jerram <neil@ossau.uklinux.net>
Cc: djurfeldt@nada.kth.se, guile-devel@gnu.org
Subject: Re: SRFI 34
Date: 07 Mar 2004 18:34:37 +0000	[thread overview]
Message-ID: <85ptboecaq.fsf@ossau.uklinux.net> (raw)
In-Reply-To: <87vfw948g9.fsf@zagadka.ping.de>

This is a thread from May 2003 that I never resolved.  I've revisited
it now because of Andreas Rottman's work on SRFI 35 (conditions),
which makes me think that it would be worthwhile finishing this whole
area off.

Marius Vollmer <mvo@zagadka.de> writes:

> Neil Jerram <neil@ossau.uklinux.net> writes:
> 
> > Our lazy-catch implementation specifically unwinds dynamic context so
> > that we see (handler #f) here rather than (handler 12).  Effectively
> > the only thing that lazy-catch doesn't unwind is the stack. 
> 
> Ahh, I see.  The lazy-catch was introduced so that one can get at the
> call stack via 'make-stack', right?

Yes.

> If so and it is consistent with the docs then we should leave it the
> way it is.  Maybe the docs need some carification.

I believe the docs are already correct on this point.  Try `i
lazy-catch' in the manual.

> > Unwinding the fluid context is contrary to my intuition, though, and
> > it appears to yours also.
> 
> Yes, but I don't think we should change such a fundamental thing about
> lazy-catch just so.

OK.

> We can introduce a new function, however.  Probably we should just
> move SRFI-34 into the core and rewrite 'error' to use it.

OK, but we need to be careful to preserve the behavior of existing
code that uses `catch' to catch errors.  Did you have a specific
scheme in mind here?  Here's what I think might work:

- `error' and libguile errors are rewritten to use `raise' and an
  appropriate SRFI-35 condition object.

- The default SRFI-34 exception handler maps the condition object back
  to a key + arg list, and calls `throw' with that key and args.

> But given the semantics of lazy-catch, I think your implementation of
> SRFI-34 is wrong.  I does _not_ run the handler in the dynamic context
> of the call to 'raise' since lazy-catch winds back to the dynamic
> context of 'with-exception-handler'.

Agreed.  (I glossed over this before, because (i) SRFI-34 doesn't
provide any examples that test the difference, and (ii) my
implementation was only a quick first attempt.)

> Can we use the sample implementation, and just change it to use a
> fluid for the list of exception handlers.  Also, maybe we can replace
> some call/cc with 'catch', but that would just be for performance.

OK, but for this I have 2 technical queries.

1. To minimize changes between the official SRFI 34 code and Guile's
   version, it would be nice to introduce
   call-with-escape-continuation (implemented using throw and catch)
   and just replace the call-with-current-continuation's in the SRFI
   34 code by call-with-escape-continuation.  Is the following a good
   definition of call-with-escape-continuation?

(define (call-with-escape-continuation proc)
  (let ((tag (make-symbol "call-with-escape-continuation")))
    (catch tag
	   (lambda ()
	     (proc (lambda (return-value)
		     (throw tag return-value))))
	   (lambda (key return-value)
	     return-value))))

2. Are the define-syntax forms in SRFI-34 OK as they are, or should
   they be translated (for Guile) to macro definitions?

Thanks,
        Neil


_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-devel


  reply	other threads:[~2004-03-07 18:34 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <Pine.GSO.3.96.1030209200016.26546A-100000@anh>
2003-02-25 14:19 ` PLEASE: debugging embedded guile code Joris van der Hoeven
2003-02-25 14:36   ` Dale P. Smith
2003-04-26 14:51     ` Neil Jerram
2003-04-26 16:40       ` Bruce Korb
2003-04-26 19:12         ` Neil Jerram
2003-04-26 20:13           ` Bruce Korb
2003-04-27 20:49             ` Neil Jerram
2003-04-27 21:57               ` Bruce Korb
2003-04-28 15:54                 ` Paul Jarc
2003-04-28 16:07                   ` Bruce Korb
2003-04-28 19:21                 ` Neil Jerram
2003-04-28 20:06                   ` Bruce Korb
2003-04-28 20:58                     ` Neil Jerram
2003-05-16 17:19                       ` Bruce Korb
2003-05-16 19:23                         ` Neil Jerram
2003-05-16 20:27                           ` Bruce Korb
2003-05-16 21:21                             ` Rob Browning
2003-05-16 21:56                               ` Bruce Korb
2003-05-17  0:31                                 ` Bruce Korb
2003-05-17  2:33                                   ` Bruce Korb
2003-05-19 15:00                                     ` Paul Jarc
2003-04-28 13:52       ` Mikael Djurfeldt
2003-04-28 19:26         ` Neil Jerram
2003-04-30  0:13           ` SRFI 34 Neil Jerram
2003-05-17  0:45             ` Marius Vollmer
2003-05-17  9:39               ` Neil Jerram
2003-05-17 20:36                 ` Marius Vollmer
2004-03-07 18:34                   ` Neil Jerram [this message]
2003-04-26 14:45   ` PLEASE: debugging embedded guile code Neil Jerram

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=85ptboecaq.fsf@ossau.uklinux.net \
    --to=neil@ossau.uklinux.net \
    --cc=djurfeldt@nada.kth.se \
    --cc=guile-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).