File tree Expand file tree Collapse file tree 1 file changed +31
-0
lines changed Expand file tree Collapse file tree 1 file changed +31
-0
lines changed Original file line number Diff line number Diff line change
1
+ =head1 Introducing Typed Exceptions
2
+
3
+ For a Perl 6 compiler to support typed exceptions properly,
4
+ the following steps must be taken:
5
+
6
+ =head2 Basic types
7
+
8
+ The compiler writer needs to implement the types C<Exception>, C<Backtrace>
9
+ C<X::AdHoc> and C<X::Comp>, as described in S32::Exception.
10
+
11
+ =head2 Exception type mapping
12
+
13
+ When the compiler passes an exception object to the user space (ie C<$!> and
14
+ inside a C<CATCH> block also C<$_>), it needs to make sure that the type
15
+ conforms to type C<Exception>, wrapping it in C<X::AdHoc> if that is not the
16
+ case.
17
+
18
+ Exceptions from non-Perl 6 sources should be boxed into a Perl 6 Str as the
19
+ payload of an C<X::AdHoc> object.
20
+
21
+ =head2 Importing other exception types
22
+
23
+ The next step is to import the exception classes and roles from S32::Exception
24
+
25
+ =head2 Compile time exceptions
26
+
27
+ The compiler needs to provide the named C<filename>, C<line> and C<column>
28
+ arguments to the constructor of the exceptions thrown from within the compiler
29
+ (TODO: TimToady wants a characters offset, not (just) line and column).
30
+
31
+ =cut
You can’t perform that action at this time.
0 commit comments