This week on Perl 6, week ending 2003-06-22

Welcome to my first anniversary issue of the Perl 6 Summary. Hopefully there won’t be too many more anniversaries to celebrate before we have a real, running Perl 6, but there’s bound to be ongoing development after that. My job is secure!

Because I can’t think of anything better to do, I’ll start with the action on the perl6-internals list.

Converting parrot to continuation passing style

The ongoing effort to convert Parrot to use/support continuation passing style (CPS) at the assembler level continues. Jonathan Sillito offered another patch implementing the require support, which Dan liked and applied.

Klaas-Jan Stol wondered what he’d missed; last time he looked Parrot wasn’t doing continuation passing. He asked why Dan had chosen to go down that route. Dan answered that he had realized that “we had to save off so much state that we essentially had a continuation anyway”. Explicitly going with continuation passing just made things more formal, and wrapped up all the context saving behind a straightforward interface. He promised a more detailed explanation later.

Portable way of finding libc, unbuffered reads

Clinton Pierce noted that the following code:

    loadlib P1, "/lib/"
    dlfunc P0, P1, "system", "it"
    set I0, 1
    set S5, "ls"

just works, which simultaneously pleases and scares him silly. He wondered if there was a good way of finding the standard C library on a Unix system without scary hardwiring as in the fragment above. He also wondered if there was an “official” way of getting an unbuffered read via parrot.

Jens Rieks came up with a gloriously evil way of finding libc. The theory goes that Parrot is linked against libc, so you just have to dlopen the running image and you can call libc functions to your heart’s content. To dlopen the running image you need to pass a NULL pointer to the underlying loadlib so he offered a patch to core.ops which interpreted an empty string as a pointer to NULL. Leo and Dan were impressed and the patch (or something similar) was applied. I get the feeling that Dan wants to do something a little less hacky to access the current executable though….

Clint noted that the dlopen the running image by passing a null pointer trick doesn’t work with Windows, but outlined a workaround for that too. Jen Rieks suggested a better Windows workaround.

Nobody came up with an approved way of doing getc, but once you have libc loaded you can just use its getc.

OO, Objects

If you look in a fresh from CVS parrot directory you’ll now find object.ops, which will be the cause of much rejoicing in many places. Dan’s nailed the object spec down enough that he’s started implementing a few of the required ops. As he points out, what we have is “hardly sufficient”, but everyone’s got to start somewhere, the journey of a thousand miles begins with but a single step, etc.

Judging by the number of comments (none), everyone was stunned into silence.

More CPS shenanigans

I get the strong feeling that Leo Tötsch isn’t entirely happy with the new Continuation Passing Style regime. He’s worried that the P6C tests break, and that CPS subs are some 3 times slower for calling the sub. This led into a discussion of what context really must go into a continuation, whether we can get away with different classes of continuation (hold more or less contextual information) and other ways of possibly speeding things up.

I’m not sure Leo has been entirely convinced, but I’m confident that Dan’s not going to change his mind about this.

Leo later submitted a large patch which unifies the various subroutine related PMCs to take into account CPS.


Now that the rules for subs/methods etc are settling down, Dan outlined his thoughts on exception handlers. If I’m understanding him correctly, an exception handler is just a continuation that you invoke with the exception as its only argument. There were no comments by the end of the week.

Meanwhile in perl6-language

The language list was quiet again. Maybe everyone was doing face to face things at YAPC. Or on holiday. Or something.

printf like formatting in interpolated strings

Remember last week I mentioned that Luke Palmer had made a cool suggestion about printf like formatting in string interpolation? (He suggested a syntax like rx/<expression> but formatted(<formatspec>)/, which I for one quite liked).

Edwin Steiner wasn’t so keen, noting that Luke’s suggestion was actually more verbose than rx/sprintf <formatspec>, <expression>/. He wasn’t entirely sure that having a formatting rule attached to a value with a ‘but’ was really the right thing to do (it does rather violate the whole model/view/controller abstraction for instance). Edwin’s favoured interpolation syntax was,

  rule formatted_interpolation {\\F <formatspec> <interpolatable_atom>}
  rule formatspec { # sprintf format without '%' 
  rule interpolatable_atom { <variable> | \$\( <expr> \) }

(or something along those lines). Edwin went on to extend his idea, allowing for all sorts of clever interpolation rules, leading Dave Storrs to comment that the Obfuscated Perl people would certainly thank him if the suggestions went in.

Arcadi Shehter came up with yet another suggested syntax involving : (neglecting the important rule that, whilst one’s heart may belong to Daddy, the : belongs to Larry. And I’m really trying not to think about the images that conjures up).

At this point, we ended up in a philosophical discussion about when was the right time to do stuff, generality of solutions and Perl remaining Perl. I remain confident that come the appropriate time, Larry and/or Damian (more likely Damian given some of the stuff he was showing off to do with formatting at YAPC) will nail things down and we’ll all go “Of course!” and move onto the next thing.

Dispatching, Multimethods and the like

Adam Turoff noted that, in his YAPC opening talk, Damian had mentioned the catchall DISPATCH sub, which will allow for altering the dispatch behaviour to do any magic you choose. The ‘problem’ with DISPATCH is defining its interaction with the likes of AUTOLOAD and other built in dynamic dispatch behaviours, which will need to be nailed down.

Dan Sugalski jetted over from perl6-internals to give the lowdown on what would be available at the parrot level (which may or may not be exposed at the Perl 6 language level). Essentially, what we know is that there will be the capability to insert any dispatch method you like, but the details of how you’d do it aren’t thrashed out yet. It almost certainly won’t be easy, but that’s a good thing.

Type Conversion Matrix, Pragmas (Take 4)

Discussion of Mike Lazzaro’s type conversion matrix continued as people explored corner cases.

Acknowledgements, Announcements and Apologies

Whee! My first anniversary! I confess that when I started writing these things I didn’t expect to keep going for this long. Now I don’t expect to ever stop.

After due and careful consideration of a short shortlist, I should like to award an anniversary virtual white parrot award to Leopold “Patchmonster” Tötsch for his astonishing contribution to the Parrot core. Other mental nominees for this award were: Clinton A Pierce, for BASIC and the associated bug finding; Leon Brocard, for humorous reasons and Robert Spier and Ask Bjørn Johansen for invaluable and invisible work on websites, CVS and mailing list maintenance.

I eliminated the core design team from consideration for the above award, but I’d like to formally thank Larry, Damian, Allison and Dan, without whom…

As I said last week, Leon Brocard is no longer the summaries’ running joke. However, I auctioned off the right to specify the next running joke at YAPC last week; next week should see the unveiling of the new, improved Perl 6 Summary Running Joke.

If you’ve appreciated this summary, please consider one or more of the following options:

  • Send money to the Perl Foundation at and help support the ongoing development of Perl.
  • Get involved in the Perl 6 process. The mailing lists are open to all. and are good starting points with links to the appropriate mailing lists.
  • Send feedback, flames, money, photographic and writing commissions, or a cute little iPod with a huge capacity to satisfy my technolust **.



Something wrong with this article? Help us out by opening an issue or pull request on GitHub