[plt-scheme] SXML for R6RS [was: R6RS Interoperability]

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Thu Jul 3 09:47:16 EDT 2008

At Thu, 03 Jul 2008 03:43:02 -0700, Derick Eddington wrote:
> I've been meaning to bring this up and ask: would it be possible for PLT
> to support any symbols for library names?  Ikarus currently does it by
> encoding filename-unfriendly characters like * to %2A.  I'd be willing
> to make a patch to do this if it's not a dead end.

That would be great.

> * SSAX issue: MzScheme does not conform [1] to the R6RS expectation that
> the initial/default exception handler return for non-&serious
> conditions [2].  Returning for non-&serious conditions allows you to do
> things like raise-continuable a &warning condition to let interested
> clients catch it and do something about it and maybe return, or the
> default handler will return, and execution can continue.  I made my
> ssax:warn procedure do this and the SSAX library frequently
> calls ssax:warn when issues that often can safely be ignored happen.  I
> hacked together a patch to MzScheme so its default R6RS handler returns
> for non-&serious, though I'm not sure it meshes with PLT completely
> correctly, and with it my SSAX port works completely:
> 
> ===========================================================================
> --- collects/rnrs/exceptions-6.ss	2008-06-22 21:01:22.000000000 -0700
> +++ /collects/rnrs/exceptions-6.ss	2008-06-25 20:30:10.000000000 -0700
> @@ -1,6 +1,8 @@
>  #lang scheme/base
>  
> -(require r6rs/private/exns)
> +(require r6rs/private/exns
> +         (only-in r6rs/private/conds serious-condition? simple-conditions)
> +         (only-in rnrs/io/ports-6 standard-error-port))
>  
>  (provide with-exception-handler
>           guard else =>
> @@ -80,7 +82,21 @@
>  
>  (define (r6rs:raise exn)
>    ;; No barrier
> -  (raise exn #f))
> +  (parameterize ([uncaught-exception-handler
> +                  (lambda (exn)
> +                    (let ([base (if (exn:continuable? exn)
> +                                  (exn:continuable-base exn)
> +                                  exn)])
> +                      (if (serious-condition? base)
> +                        (raise exn #f)
> +                        (begin
> +                          (display (format "Uncaught Exception:\n~s\n" 
> +                                           (simple-conditions base))
> +                                   (standard-error-port))
> +                          (when (exn:continuable? exn)
> +                            ((exn:continuable-continuation exn) 
> +                             (lambda () (values))))))))])
> +   (raise exn #f)))

That's an interesting approach. I'm not sure that it's consistent with
everything else, either, but it seems like an improvement for now.

Matthew



Posted on the users mailing list.