Completed Hague Grant

Jonathan Worthington has successfully completed his Hague Grant for Rakudo Signature Improvements. This is his final report:

Introduction

A while back, I filed an application for a grant to work on a wide range of improvements to Rakudo's signature, capture and binding implementation, in order to improve performance, bring us in line with the specification and implement a range of features that we did not have support for.

I have now completed the grant tasks, and am filing this report to discuss the work that was done under it. I have missed the originally planned schedule for the grant to be completed. This was in a large part due to a lot of Rakudo development since October taking place in a branch, ng, which set out to refactor and improve many aspects of Rakudo and get us in good shape for the Rakudo * release in a couple of months time. It made far more sense to implement some aspects of this grant in the branch rather than in master, and the branch also needed my attention in other key areas. The branch has recently become master, and since then I've been able to complete the final pieces of the grant and bring it to completion.

Deliverables Status

I proposed six deliverables, and have completed all of them.

D1 called for an extensive refactoring of signature internals and parameter binding. Rakudo now has a single custom signature binder, designed to handle its binding needs in accordance with the Perl 6 specification. This is a far better situation than before, where we used the Parrot binder and then layered extra binding semantics atop of it, meaning we had to make two passes through the parameters.

Having our own custom binder that takes into account the needs of Perl 6 has made it possible to do all of the other items in this grant in a clean and performant way. It has also enabled other bits of progress outside the scope of the grant; for example, I was able to get a first cut of coercion (the "as" trait) of parameters in signatures implemented in little over half an hour a few days ago.

We also have compile-time objects to represent signatures and parameters in the compiler. This has allowed much cleaner code in the actions that build the AST. In the future, this approach will also be highly useful for building extra static checking and an optimizer.

D2 required implementing support for binding named arguments to positional parameters. I considered this in the initial re-design of the binder, so it just worked "out of the box" once I switched Rakudo over to using it.

The target of D3 - unpacking of arguments - was made much easier by having a custom binder. The binder was designed to be re-entrant, and therefore unpacking arguments was implemented by specifying how various data structures could coerce themselves into a capture, and then making a recursive call with the capture that was produced.

For D4, I spent some time re-working capture support overall, and as well as being able to write a capture into a signature - and to unpack it with a sub-signature - we can also interpolate a capture into the arguments for a call. Before this didn't really work - it would lose the named parameters, for example.

Implementing D5 - support for multiple return values - first meant working with Larry to figure out the correct semantics. It turned out they were easier to get in place in the refactored "ng" branch - which has now become the master branch. I also implemented the support for binding the return values against a signature; this means all the power of unpacking arguments is available for returns too. It's all routed through the same underlying binder implementation.

Finally, for D6 I first put a proposal into the specification for how signature introspection should look, then wrote an implementation and reviewed the test coverage.

Dissemination

I have written some blog posts (1, 2, 3) about the work that I have done under this grant. I've also been active on the #perl6 IRC channel and, thanks to the evalbot, been able to give some demonstrations of the improvements there too. I also continue to attend Perl conferences and give talks about Perl 6.

Conclusions

This grant has, like my previous two, brought another major piece of Rakudo essentially "up to spec" and provided a good, stable base for future development. Our coverage of S06 is vastly improved, along with performance. Overall this grant has helped us meet critical targets on the path to the Rakudo * release and, beyond that, towards Rakudo becoming a complete Perl 6 implementation.

About TPF

The Perl Foundation - supporting the Perl community since 2000. Find out more at www.perlfoundation.org.

About this Entry

This page contains a single entry by Karen published on March 3, 2010 10:30 AM.

YAPC::NA 2010 Call For Papers was the previous entry in this blog.

2010Q1 Grant Proposals: Results is the next entry in this blog.

Find recent content on the main index or look in the archives to find all content.

OpenID accepted here Learn more about OpenID
Powered by Movable Type 4.38