Macros progress report: D1 merged
I've merged my first chunk of work, known to the grant application as "D1", into the nom
branch of Rakudo. Concretely, this means three things:
- The next release of Rakudo (release #50, due 2012-03-22) will be the first release of any Perl 6 implementation to feature AST macros.
- People who have a new-enough revision of the
nom
branch checked out can play around with basic macros already. - There's just three chunks of work left to do.
:-)
The work has progressed nicely so far. It's been a little trickier than I expected, but not insurmountable yet, and I've received plenty of support from jnthn++. The time estimates were way too optimistic, it turned out — partly because the grant took a while to get accepted, partly because $dayjob
keeps wanting tuits — but at least I'm not stuck.
One interesting aspect of the grant that I didn't expect is that much of my thinking happens in gists. Increasingly, I'm beginning to see gists as a sort of "semi-private blog posts". They're notes mainly left for myself and my creative process, and they don't clutter up the blog feed, but they're there if people are interested enough to see how sausage is made. I don't go back and "fix" gists when I learn new things that contradict what's in them — I just write new ones.
Here, just for reference, I collect all the gists I've made so far philosophizing on macros:
- Musings on macros
- Macros and short-circuiting
- More thoughts on macros
- (at this point, I wrote the grant application)
- D4, deconstructed
- I'm thinking about macros again
- Cool use for a macro: meta for
- The lifetime of a macro invocation
I have one more gist coming up that I haven't written yet, about how macro-argument AST thingies are thunkish and rebind to their outer context just like closures do.
The other "artifacts" that have fallen out of the grant work so far, are:
- A spectest file. Too few tests in it, even though I've tested everything I can think of. There will be more tests for D2, I'm sure.
- A monolithic commit to Rakudo, representing my D1 work. I did a bunch of rebase operations on the way to keep current with the
nom
branch, and each time I folded a number of commits into a single one, because I considered most commits after the original one from September to be "oh right"-type afterthoughts. Not sure how this rhymes with jnthn's post about atomic commits... I'm a bit divided on the issue. - A talk, at Deutscher Perl Workshop in Erlangen. You can see the slides here.
Looking ahead a bit, what's up next is D2. Informally, D2 consists of "getting those little {{{$stuff}}}
thingies to work". We need a way to represent "there's a placeholder here" in the AST, because that's how the ASTs look during the static part of their lifetime (before macro application). It will require a new AST type. As it happens, PAST in nqp/Rakudo is just about to be replaced by the next generation of AST technology, and jnthn++ is just about to start working on that. So it makes sense for me to assist him, since I'm now blocking on the new AST technology landing in Rakudo for my macros work. Aside from blocking, I expect D2 to be quite easy to implement.
See you again at the next milestone. And possibly at part-way resting stops in between.