Moritz has completed his grant and provided the following closing report.
Moritz Lenz writes:
After working for more than a year on my "grant on exceptions":http://news.perlfoundation.org/2011/02/hague-grant-application-struct.html, I am now confident that I have done all that I have promised, and can now close the grant.
DeliverablesA short summary of what I did for each deliverable follows
D1: Specification
"S32::Exception":http://perlcabal.org/syn/S32/Exception.html contains my work in this area. It provides information about the basic exception types, the backtrace printer and how they interact with the rest of Perl 6.
There are certainly still open design question in the general space of exceptions like, how do we indicate that an exception should or should not print its backtrace by default? There are ways to achieve this right now, but it's not as easy as it it should be for the end user. However those open questions are well outside the realm of this grant. I still plan to tackle them in due time.
Several "approaches to localization and internationalization":http://perlgeek.de/blog-en/perl-6/2012-localizing-exceptions.html are now within reach and only wait for somebody to do it.
D2: Error catalog, tests
The error catalog is also in "S32::Exception":http://perlcabal.org/syn/S32/Exception.html. It is not comprehensive (ie doesn't cover all possible errors that are thrown from current compilers), but the grant request only required an "initial" catalog. It is certainly enough to demonstrate the feasibility of the design, and to handle very many common cases.
Tests are in "the roast repository":https://github.com/perl6/roast/blob/master/S32-exceptions/misc.t. At the time of writing (2012-06-07) there are 424 tests, of which Rakudo passes nearly all (the few failures are due to known bugs not related to the exception subsystem). I added a utility test function throws_like
to Test::Util
which makes testing of typed exceptions very easy.
D3: Implementation, tests, documentation
Rakudo now throws only typed exceptions from its setting (with the exception of internal errors). Note that before my work started it only allowed strings as exceptions.
The tests mentioned above already cover several bug reports where people complained about wrong or less-than-awesome error messages. Since my main motivation was to make error testing more robust, I consider this a big success.
Documentation for "compiler writers":https://github.com/perl6/mu/blob/master/docs/exceptions.pod and "test authors":https://github.com/perl6/roast/blob/master/packages/Test/Util.pm#L177 is available.
Other Exceptions ProgressI'd also like to mention that I did several things related to exceptions which were not covered by this grant:
I'd like to thank Ian Hague and the Perl Foundation for funding this grant, Karen Pauley and Will Coleda for managing it, and all the people who helped me designing, programming and wording things, especially Jonathan Worthington.
References