Jonathan Worthington: February 2008 Archives

I've been at the German Perl Workshop for the last few days. While I was sat in a bunch of talks being presented in a language I don't understand, I had some free time to hack on Rakudo. That means there's been a few fixes and some new features.

First, I set about doing some re-factoring to the objects work I had done so far. It had wound up with a lot of inline PIR in actions.pm, and that in turn fixed us to one class system, which was fine for a first-cut implementation to get a few things working, but far from what S12 calls for. Now all the inline PIR I added is gone, replaced by calls to methods written in PIR.

With the refactoring done, it was then far easier to add what is needed to have methods in classes resolving conflicts and taking precedence during role composition. Of course, exactly how well the roles implementation matches S12 is yet to be seen, and that calls for lots of tests. I'll be drawing on the Moose ones for that.

With some basic OO support in and ready for people to play with, I moved on to looking at the regex support. There was already some there, but I've put in a bit more. $/ (the match variable) wasn't being passed into inner scopes, so if you did a pattern match in the condition of an if block then $/ would not be set inside the block. That is now fixed. Additionally, I implemented $0, $1, $2, etc numbered captures, as well as $ and $ named captures. There is also the "regex" keyword for introducing named regexes, so you can say stuff like:

regex Year {\d\d\d\d};
regex Location {German|French|Italian|London|Dutch|Ukrainian};
regex PerlConference {<Location>\sPerl\sWorkshop[\s<Year>]?};

I've got rule and token parsing, but they don't pass along the :ratchet and :sigspace modifiers yet. I hope to have that resolved soon.

A natural fall-out of adding support for $ is that %hash is now also supported for using constant hash keys. So that's another small bit done. Anyway, enjoy the new toys, and bug reports welcome.

Recently I've been doing more work on implementing Perl 6 OO support in Rakudo. You can read the full write-up, but as an overview:
  • Attributes are now more in line with S12, storing them at $!foo under the hood no matter what twigil they are declared with, generating an accessor/mutator of the twigil is '.' and creating a lexical alias to the attribute if there is no twigil (so has $x means you can use $x and $!x to refer to the attribute).
  • The initial work to support inheritance is in place. And it really is implemented through a generic trait application mechanism, not special-case code.
  • The "self" keyword can be used now.
  • The very initial bits of work on roles are in, but the composition semantics are not correct yet. That will change soon.
Enjoy, and I hope to have more stuff to report on soon.

About this Archive

This page is a archive of recent entries written by Jonathan Worthington in February 2008.

Jonathan Worthington: March 2008 is the next archive.

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

Subscribe

    Subscribe to rakudo.org

Powered by Movable Type 4.1
Technorati Profile