[plt-scheme] How to define exceptions in typed-scheme?

From: Richard Cobbe (cobbe at ccs.neu.edu)
Date: Wed Jan 20 07:46:16 EST 2010

On Wed, Jan 20, 2010 at 12:23:03AM -0500, Ryan Culpepper wrote:
> Richard Cobbe wrote:
> >I'm using Typed Scheme, and I'm trying to define exception structures that
> >inherit from the native PLT exception hierarchy.  Typed-Scheme doesn't
> >provide types for these structs, so I'm having to do it myself with
> >require/typed.
> It looks like it includes types for a few exns but not all. In
> particular, exn:fail is typed, but exn:fail:contract seems not to
> be. So you can work around it for now if you don't mind extending
> exn:fail directly instead of exn:fail:contract.

Aha, good to know.

Are there any practical consequences to skipping over exn:fail:contract?

I suspect not -- I've always extended the existing exn hierarchy partly
because, somewhere along the line, I picked up the notion that this was a
Good Idea, and because I believe the inclusion of the continuation mark set
lets DrScheme provide useful information if an exn escapes all the way back
to the REPL.

I imagine that extending exn:fail instead of exn:fail:contract still
provides these benefits (the continuation marks are still there, after
all), but I'm wondering if there's anyone else who expects these exceptions
to be exn:fail:contracts instead.



Posted on the users mailing list.