[Top][All Lists]

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

Re: [Chicken-users] Expecption Handling with chicken

From: Michael Erdmann
Subject: Re: [Chicken-users] Expecption Handling with chicken
Date: Sat, 02 Oct 2004 18:35:29 +0200
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7) Gecko/20040616

Thomas Chust wrote:
Michael Erdmann wrote:

The interface i a little bit funy but look very mutch
like the try...catch construct of java.

;; creating an intecepting an exception
   (lambda (exit)
      (handle-exceptions exn
         (begin (put-line "Went wrong") (exit exn) )
         (put-line "Expression 1")
         (abort 'x)))


try {
   throw ..
catch(Exception e) {


I can even use vectors or records to build exception types. Fine! Only
this  call-with-current-continuation is clumsy.

If it's only the clumsy function name you dislike, you can write call/cc instead of call-with-current-continuation -- that's not R5RS but a very common abbreviation supported by many Scheme implementations.

But the call-with-current-continuation in your example above is completely superfluous. You could write
       (handle-exceptions exn
            (put-line "Went wrong") exn)
          (put-line "Expression 1")
          (abort 'x))
instead and get exactly the same behaviour. (Nevertheless call-with-current-continuation is used internally by handle-exceptions to do what it does...)
Thanks, when reading the srfi i got the impression i have to do this. If
it not required even better.

Is there any way that i can initiate a backtrace at my will?


reply via email to

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