chicken-users
[Top][All Lists]
Advanced

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

Re: [Chicken-users] catching exceptions


From: Elf
Subject: Re: [Chicken-users] catching exceptions
Date: Tue, 29 Jul 2008 02:56:05 -0700 (PDT)


i explained this already.
you want with-input-from-string.
not call-with-input-string

-elf

On Tue, 29 Jul 2008, Jörg F. Wittenberger wrote:

Hi all,

continuing my experiments to catch exceptions in chicken, I've been
working out a more core-chicken-only example.

Let's see.  Is this correct as a minimal example?
--- %< tg.scm ----
(require-extension srfi-34)
(print (guard (ex (else 'success)) (call-with-input-string ")" read)))
--- %< ----

no, for two reasons:
first, you need to (require-extension ports) for call-with-input-string.

Now I tried:

--- %< tg.scm ----
(require-extension ports)
(print (condition-case
        (call-with-input-string ")" read)
        (var () 'condition-case-does-a-better-job-than-guard)))
--- %< ----

And here the result:

$ csc -o tg tg.scm
$ ./tg
Error: unexpected list terminator: #\)

        Call history:

        ##sys#require
        call-with-current-continuation
        with-exception-handler
        ##sys#call-with-values
        call-with-input-string                  <--

Looks as if condition-case is - too - unable to catch the exception.

Did I still do anything wrong?

best regards

/Jörg

reply via email to

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