Permalink
Browse files

[docs] add some documentation on how to introduce typed exceptions

  • Loading branch information...
1 parent 86b4827 commit cf222bccab606ab669cbc927abcb92d21e7eae86 @moritz moritz committed Jun 5, 2012
Showing with 31 additions and 0 deletions.
  1. +31 −0 docs/exceptions.pod
View
31 docs/exceptions.pod
@@ -0,0 +1,31 @@
+=head1 Introducing Typed Exceptions
+
+For a Perl 6 compiler to support typed exceptions properly,
+the following steps must be taken:
+
+=head2 Basic types
+
+The compiler writer needs to implement the types C<Exception>, C<Backtrace>
+C<X::AdHoc> and C<X::Comp>, as described in S32::Exception.
+
+=head2 Exception type mapping
+
+When the compiler passes an exception object to the user space (ie C<$!> and
+inside a C<CATCH> block also C<$_>), it needs to make sure that the type
+conforms to type C<Exception>, wrapping it in C<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 C<X::AdHoc> object.
+
+=head2 Importing other exception types
+
+The next step is to import the exception classes and roles from S32::Exception
+
+=head2 Compile time exceptions
+
+The compiler needs to provide the named C<filename>, C<line> and C<column>
+arguments to the constructor of the exceptions thrown from within the compiler
+(TODO: TimToady wants a characters offset, not (just) line and column).
+
+=cut

0 comments on commit cf222bc

Please sign in to comment.