Skip to content
This repository
branch: master
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

file 32 lines (20 sloc) 1.05 kb

Introducing Typed Exceptions

For a Perl 6 compiler to support typed exceptions properly, the following steps must be taken:

Basic types

The compiler writer needs to implement the types Exception, Backtrace X::AdHoc and X::Comp, as described in S32::Exception.

Exception type mapping

When the compiler passes an exception object to the user space (ie $! and inside a CATCH block also $_), it needs to make sure that the type conforms to type Exception, wrapping it in X::AdHoc if that is not the case.

Exceptions from non-Perl 6 sources should be boxed into a Perl 6 Str as the payload of an X::AdHoc object.

Importing other exception types

The next step is to import the exception classes and roles from S32::Exception

Compile time exceptions

The compiler needs to provide the named filename, line and column arguments to the constructor of the exceptions thrown from within the compiler (TODO: TimToady wants a characters offset, not (just) line and column).

Something went wrong with that request. Please try again.