[plt-scheme] Code for catching exceptions in embedding applications

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Sun Oct 5 20:19:52 EDT 2008

At Sat, 04 Oct 2008 19:02:42 +0400, Sergey Khorev wrote:
> While trying to migrate an application to PLT 4.1, I stuck with 
> exception handling.
> 
> Code below (basically it has been extracted from PLT documentation) 
> crashes with
> #f::0: compile: bad syntax; function application is not allowed, because 
> no #%app syntax transformer is bound in: (lambda (thunk) (with-handlers 
> ((void (lambda(exn) (cons #f exn)))) (cons #t (thunk))))
> 
> Seg fault (internal error) at 4
> 
> Do I need to `require' some module for this to work?

Yes. The initial namespace is empty; it doesn't even have syntax for
`lambda' or for function application. So, you need to require something
like `scheme/base'.


Matthew



Posted on the users mailing list.