unofficial mirror of bug-guile@gnu.org 
 help / color / mirror / Atom feed
From: "Göran Weinholt" <goran@weinholt.se>
To: 14922@debbugs.gnu.org
Subject: bug#14922: guard expression doesn't catch everything
Date: Sun, 21 Jul 2013 11:29:03 +0200	[thread overview]
Message-ID: <87d2qcqn1c.fsf@industria.weinholt.se> (raw)

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

Hello schemers,

the guard expression from (rnrs) would be a lot more useful if it
managed to catch all exceptions. As it is now, some errors will bypass
the guard:

scheme@(guile-user)> (import (rnrs))
scheme@(guile-user)> (guard (exn (else #f)) (fx+ #f #f))
$1 = #f
scheme@(guile-user)> (guard (exn (else #f)) (fx+))
;;; <stdin>:3:0: warning: possibly wrong number of arguments to `fx+'
rnrs/arithmetic/fixnums.scm:153:2: In procedure fx+:
rnrs/arithmetic/fixnums.scm:153:2: Wrong number of arguments to #<procedure fx+ (fx1 fx2)>

The background is that I'm working on a program that intentionally calls
procedures with bad arguments, and it needs to determine if the
procedure accepted the arguments or not. Ideally the object raised would
be a proper and correct R6RS condition object, but I suspect that most
of the existing Guile code doesn't raise conditions like that. I think
it would be a step forward if guard at least caught the exception, even
if the condition object might not be very useful.

Tested with Guile 2.0.9.40-824b-dirty.

Regards,

-- 
Göran Weinholt <goran@weinholt.se>
"Bring me back // to a story left untold // so we can write the ending."
 -- Aly & Fila feat. Jwaydan - We Control The Sunlight

[-- Attachment #2: Type: application/pgp-signature, Size: 835 bytes --]

             reply	other threads:[~2013-07-21  9:29 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-21  9:29 Göran Weinholt [this message]
2013-08-10 17:07 ` bug#14922: Improving R6RS exception handling in Guile Mark H Weaver

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=87d2qcqn1c.fsf@industria.weinholt.se \
    --to=goran@weinholt.se \
    --cc=14922@debbugs.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).