Hague Grant Application: Structured Error Messages

We have received the following Hague Grant application from Moritz Lenz.

Before the Board votes on this proposal we would like to have a period of community consultation. Please leave feedback in the comments or if you prefer send email with your comments to karen at perlfoundation.org.

Name

Moritz Lenz

Project Title

Structured Error Messages: Design and Implementation

Synopsis

A system for error messages will be designed, and implemented in Rakudo, that makes it easy to programmaticially identify and classify errors. This will apply to errors from the compiler, run-time errors and custom errors thrown by the user.

Benefits to Perl 6 Development

The Perl 6 makers strongly emphasize good error messages, but the absence of a specification or standard currently leads to divergence of error messages between the different compiler projects. This project aims to unify them again, by providing a standard, and data files to obtain error message formats from.

Also non-standard error messages make it nearly impossible to write robust tests for getting the right error message for a particular failure mode, leading to either regressions due to lack of tests, or implementation-specific tests. Significantly improved testability is both a goal and the main motivation for this project.

Finally Perl 6 needs a specification for error messages at some point for the benefit of the users, advancing it is a natural step on the path to Perl 6.0.

Deliverables

D1: Specification

I will design a system that makes it easy to construct error objects, makes it easy to query error objects for useful# information (for example if it's a compile time or a runtime error, related to IO, related to numeric operation etc). The design will make it easy to add custom error modes, and enable hooks for localization and internationalization. It includes description of an (or possibly multiple) error class, ways to identify and query errors, and an API for customizations.

It will be developed in collaboration with the Perl 6 design team, and the contributors of all major Perl 6 compiler projects.

D2: Error catalog, tests

Based on the current error messages from STD.pm, Rakudo and Niecza, an initial catalog of standardized error messages will be compiled, and provided in a form that makes it easy to use by compiler writers.

Tests for the official spectest suite will be written, both for the error API, and for individual cases where failures are provoked on purpose, and tested for leading to the correct
error.

D3: Implementation, tests, documentation

I will implement the error construction and classification/introspection mechanism in Rakudo, and switch all error messages triggered from within Perl 6 code to the new system.

I will also extend the tests, and replace most tests for error messages with tests for error objects or error characteristics. I'll also make it very easy to write such tests, and provided documentation for compiler writers and test writers on how to properly deal with error situations.

Schedule

Work on this grant could start as early as March 2011, and is planned to take 1 to 2 months per deliverable.

Report Schedule

I plan to blog at least every two weeks, on a blog that is assembled by planetsix.perl.org. A final grant report will be submitted to TPF.

Repositories

All result of my work will be added to public repositories: contributions to the specification and the spectest suite to the roast repository, contributions to Rakudo to the Rakudo repository.

Code Ownership and License

By German laws I have imprescriptible ownership of my code. It will be licensed under the Artistic License 2.0 (to be compatible with the licenses of all projects involved). I have signed a TPF CLA.

Bio

I hold a German Diploma in Physics and a Master of Honours in Physical Science, and I have a strong background in computer science. I have been contributing to Perl 6 since 2007, and have made more than 2000 commits to the test suite and more than 1000 to Rakudo, contributed to the Perl 6 specification, blogged, and I'm one of the main authors of the "Using Perl 6" book (to be published by Onyx Neon Press).

Amount Requested

Since my employer allows me only to earn 400 Euro per month additionally, I request 400 EUR or 540 USD per deliverable, ie. 1200 EUR or 1620 USD in total.

Moritz has made many great contributions to the Perl 6 project so far and worked well with everyone. This grant identifies a genuine weakness that should be addressed on the way to a full Perl 6 implementation, and provides a solid plan for doing so. It's also the kind of work that I feel moritz could deliver successfully and to a high standard. So, a big +1 from me.