A roadmap for 6model and nqp-rx changes

The Raku Programming Language Collect, Conserve and Remaster Project

A roadmap for 6model and nqp-rx changes

Originally published on 2010-09-11 by Jonathan Worthington.

So, I had a lovely vacation in Central Europe…

Lovely Ljubljana

…and now it’s back to the hacking! :-)

While the eventual goal of my current grant is, obviously, to deliver significant improvements to Rakudo, there are quite a lot of preliminaries that need to be taken care of first. My first steps have been to spawn a small research project in which I’ve done from-scratch prototype of how the Raku meta-model could look, plus a few things around it to be able to actually run some code. The project, named 6model, currently consists of:

So, that’s where things stand today. So where are we going from here? I’d like to break this down into two parallel tracks, both of which I’m going to be working a lot on in the coming weeks.

The 6model Research Track

The 6model project has been highly valuable so far for exploring design, and there’s a few things I want to explore further in it. My main research tasks here over the coming weeks will be (this is a rough ordering):

  1. Getting a working and efficient lexical multi-dispatch working, and integrating/testing the dispatch cache I recently committed
  2. Work out how to do multi-method dispatch with the same kind of mechanism also
  3. Some more bits to start supporting native attributes
  4. Finish up Rakuopaque representation and support attributes in KnowHOWs
  5. Start working towards running a very basic ClassHOW – that is, an implementation of classes

The nqp-rx Track

Now that I’m increasingly happy with various parts of the model I’ve explored and evolved in 6model, it’s time to start bringing it to the Parrot implementation of nqp-rx, as a pre-requisite to bringing it to Rakudo. However, there are a couple of other things that I expect to do first in Parrot nqp-rx, simply because they are dependent on having a bootstrapped NQP to do them.

Here is a rough outline of how I expect things to go, though some of these may well be re-ordered and they’re also in places parallelizable. I’ve broken it down into phases. Note that if your eyes glaze over at some of the terminology, don’t worry – I’ll blog a lot more on the details of many of these in the future.

Phase 1: get classes and grammars using the new meta-model

Phase 2: building meta-objects at compile time and supporting gradual typing

When we get to this point, we probably do have enough to start on getting Rakudo to use the new meta-model. However, it’s not the end of the changes that I think we’ll really want; next comes:

Looking a little further down the road (quite probably beyond getting my current grant done unless this suddenly becomes important), I also somewhat expect that nqp-rx may switch away from using Parrot’s String/Integer/Float/ResizablePMCArray PMCs to using real objects implemented in a low-level setting, using representation polymorphism, as shown in the example I linked earlier. That would further entail switch all operators over to be Raku multi-dispatch subs. Rakudo has already done the latter and will certainly do the former in the new meta-model implementation. But it could well make a lot of sense – especially from a semantics and portability angle but maybe also a performance and usability one – to do this in NQP too.

So when will the nqp-rx branch that all this will take place in get merged (or possibly just become master)? Well, the answer is “probably not until Rakudo itself has evolved far enough to work on it”. This is going to entail a Rakudo branch, targeting an nqp-rx branch, for a while until we’re ready to switch them both.

This is, really, the same kind of depth of change as when we went from the first NQP implementation to nqp-rx. I’m not saying that we’ll end up with the mass regressions seen in Rakudo that were a necessary part of that process – I expect to pull this off with very little of that, simply because the nature of the changes here are very different.  But a lot of things are going to look quite different after this process, and it’s not going to be without some pain. It is, however, a critical part of the path on the way towards Rakudo being a high quality Raku implementation, and NQP and the compiler tools surrounding it being a high quality tool chain for implementing a language atop of a VM.