This file is part of the Perl 6 Archive

Note: these documents may be out of date. Do not use as reference!

To see what is currently happening visit

Perl6 Summary for week ending 20020707

Hello, good evening and welcome to the third of my attempts to summarize the comings and goings in the world of Perl 6. When we last saw them our heroes were getting to grips with stack performance and having fun with the Perl 6 grammar.

Let's see what they got up to this week...

PerlArray strange behaviour

At the end of last week, Josef H\xF6\xF6k (the man whose name I have to cut and paste...) found some peculiarities when using negative indices with PerlArray objects in Parrot. Jeff (DrForr) explained that the problem arose from Josef using partially deprecated assembly syntax, and that he should use the new set P0[-4], 1 type syntax instead; Leon Brocard (who needs nested datastructures) asked when we'd see support for set P0[2], P2.

Fun with the Perl6 Grammar

The fun never stops at Sean O'Rourke's house as he released two versions of his Perl 6 grammar. Improvements include:

  • err and // have arrived.
  • Topicalization
  • $^foo variables (for subroutine creation)...
  • loop(;;) { ... }

Sean points out that it lacks any way of distinguishing between lvalues and rvalues, and that he's not even started to worry about Apocalypse 5.

I (and I assume everyone else) was very impressed.

Stack performance (and other bits...)

Tom Hughes patch from last week was well received and should be going in. However, Melvin Smith pointed out that it would probably be a good idea to apply a similar fix to register stacks. Tom and Melvin also noted that, currently, stack frames aren't handled by the Garbage Collector (which needs fixing for Coroutines and Continuations to work; see later for more about continuations...)

More on multidimensional arrays

And on PMC instantiation. In the middle of the discussion about multidimensional arrays and how to implement them, Dan commented that "It seems pretty obvious right from the start that we need some mechanism for passing parameters when creating new PMCs, something [...] that I've been ducking since I'm not quite sure how to do it. Time to stop ducking, I expect."

If anyone has a room with a wraparound whiteboard (or a nice soft room with a wraparound sweater), Dan can be contacted via the list.

In another PMC related question, Dan commented that we don't have a list of the minimally required PMCs, and dropped a massive hint that it'd be really good if someone would make such a list.

Reflexive threadnames...

Some bloke called Piers Cawley posted a summary of the week's activity on the Perl 6 lists. Normally I wouldn't comment, but it actually kicked off a thread...

Ruby Iterators

The summary prompted Erik Steven Harrison to clarify his question about ruby iterators and 'pass by name'. People understood it this time. In the thread we learned a little about the strangeness in some of Ruby's scoping rules, and Larry told us that Ruby is the reason he "decided to keep 'my' explicit."

init_method_t for coroutines and subs

Josh Wilmes has been seeing a pile of compiler warnings about the init functions for parrotsub and parrotcode not matching the init_method_t type in the _vtable struct. The answer appears to be that PMC initialization is in flux at the moment. Initially Melvin Smith added an int argument to the function signature to allow for extra configuration, but that was removed because, although it addressed the issue, it didn't go far enough. Right now, Dan is trying to work out what does go far enough without (like Tom Lehrer) going too far.

Stack rework

Melvin Smith has modified the stack structures: stacks are no longer circular. This simplifies stack handling, GC tracing, and allows stack trees, which will hopefully make Copy on Write (COW) and continuations less expensive. Which is nice.


Continuing his march towards Coroutines and Continuations, Melvin Smith unveiled the Parrot_Context data structure. Jerome Voillon questioned the wisdom of a design that led to memcpying 2k for each co-routine call. In response, Dan pointed out that patches were welcome...

Having a COW

Markus Laire wondered what 'COW' meant. Aldo Calpini told him (it stands for Copy on Write), Nicholas Clark clarified, and Larry pointed out that "It's a real win for regexes that want to map $1, $2, etc. onto an existing string."

Vtables and multimethod dispatch

Dan returned from YAPC fired up and ready to work on the extension mechanism, but before that "we need a multimethod dispatch for vtable calls." Which means that "we're going to have to do matrices (at least 2D matrices), class dependencies (so derived classes can inherit from parent classes so as not to leave gaps), and method registration at PMC load time."

Most of which Dan had been hoping to avoid.

Sean O'Rourke jokingly wondered if "resolution based on distance in number-of-args dimensional type space is right out" because it would give us bragging rights over the Java and Ruby people; Dan capped that by saying it wasn't ruled out.

Mike Lambert cheered, and offered an overview of a couple of lookup methods. He also made some points about "registering methods to be called that aren't in either PMC" as a way of allowing for pluggable (say) maths libraries, which looks like an interesting idea from where I'm sitting.

Meanwhile over in perl6-language

Mike Schwern carried on the Ruby Iterators thread with an overview of Perl 6's different ways of creating subroutines with named arguments, a confirmation that yes, it would be possible to write Ruby Iterator type things in Perl 6. Luke Palmer agreed some more and Allison Randal (a new member of the Perl 6 core team) confirmed that idea further (with a small amount of clarification).

We all wondered what a Jensen Machine is.

What's new continued

I confess that when I contemplated summarizing this particular thread I found myself wondering 'How?'. Maybe the strain of this sort of thing was what led Bryan to quit. Anyhoo...

Raptor attempted to summarize what's new in Perl 6 compared to Perl 5, or at least what's new in Apocalypses 1->4. Damian offered a bunch of comments and clarifications, as did Larry, and there was a discussion about the hyper operator, then about hypering constructors and/or the '.' operator; Damian scared us by making Dobermans; Uri posted some syntactically correct Perl 6 (marked down for style though) and Ashley Winters did cunning things with the new Perl 6 for loop syntax and generally demonstrated a worryingly complete grasp of the language (he'll be writing a scheme interpreter in Perl 6 before long...).

Your summarizer is left hoping that someone will incorporate the corrections and clarifications into a revised version of the original post which I can point you at next week...

Regex syntax clarification

Ralph (surname unknown) asked some questions about the syntax for code that gets executed within a regex and wondered if it wasn't all a bit cryptic. Allison Randal claimed, and I think I agree, that it wasn't really cryptic, it was just a new set of mnemonics to learn. Anyway, if you want a more explicit syntax you can 'just' doctor the current grammar...

The Jensen's Machine, generators and coroutines.

At last, Thom Boyer informed us that Jensen's Device is a technique used to implement pass-by-name. He also gave us an example of why pass-by-name is, well, weird. He also wondered about Python-like generators. Peter Scott wondered in turn if they weren't just coroutines in a different guise (which they are). Larry confirmed that Parrot would definitely have Coroutines, but said that he was still thinking about precisely how they'd fit into Perl 6, saying "we want fancy control structures to just kind of sneak into people's consciences, just as closures did in Perl 6. [...] It'd be really nice to find a way to explain continuations to people without inflicting the typical tortuous explanations on people who aren't interested in brain pretzels." He then offered a classically Larryesque explanation of continuations "... most people think they understand time travel ...", but you can read that in the original. Jensen's Device explained here... Larry explains continuations.

Speaking of continuations...

Piers Cawley asked about reflective capabilities when looking at code refs, suggesting a couple of methods arity and prototype which would allow one to grab information about the expectations of a subroutine, which would be very useful for people writing debuggers, refactoring browsers and other coding tools.

He then spoiled everything by suggesting $sub.current_continuation (later retracted because it doesn't make much sense...) and $sub.current_continuation($a_continuation) (later expanded on). This scared Dan, but he didn't see why it couldn't be done, so Piers just got weirder and rode his "I'd like to be able to do caller(...).as_continuation" hobby horse again. Sean O'Rourke saw Piers's weirdness and raised, proposing $current_block.push_continuation(any(*@some_ccs)) as a way of doing multithreading but I think (hope) he was joking about that, and went on to suggest a slightly less scary, but still weird $block.as_continuation. Dan got weirder still.

Then Piers attempted to summarize the thread so far, retracting some things, showed how at least one of his proposals could be implemented with a 'simple' closure and showed (and explained) a simple example of continuation usage, along with a couple of examples that did the same thing more simply...

Sean O'Rourke appeared to understand what was going on. the initial, innocuous post in this thread. and then it all goes spoggly. Piers attempts to explain continuations.

Perl 6, the Good Parts Version

Mike "Inigo Montoya" Schwern is hoping to be giving a talk with that title to the Scandinavian Conference on Object Orientation, so he posted his outline of what he's planning to talk about and asked for suggestions.

There was then a small amount of debate about the difference between adverbs and adjectives, and a plea from Larry that we stop calling adjectives 'attributes' and to use 'properties' instead to avoid terminology collision with the OO meaning of attributes.

Tim Bunce reckoned that the new regular expressions were a good thing. Piers wondered if you could implement a Prolog like language entirely within the regex engine. Erik Steven Harrison reckoned that new regexes wouldn't really sell; people already know that Perl does regexes better than anyone and the new parsing features would probably not be the sort of thing to persuade a Java user. Thread root.

$RS paragraph mode is not going away

Trey Harris worried that the very lovely and worthwhile $/ = '' was going to stop working and made an impassioned plea to keep paragraph mode. Larry reassured him that paragraph mode would be kept, but was becoming a per filehandle property.

In Brief

Josh Wilmes wondered about XML. Nobody said anything.

It was pointed out that returns a 404. So, there's no cabal there then.

Bill Atkins suggested using has, have and are instead of (or as well as) is. He also suggested that Perl 6 become more PHP like. He got pointed at previous discussions on this very subject (has/have/are) and was asked what was wrong with Mason/Template Toolkit. Ashley Winters wondered about infinite quantifiers and greediness in regular expressions. Larry did some thinking aloud on the subject and I think it was decided to stick with what we have...

Dan pointed us all at Apparently some slashdotter wonders why Larry isn't contributing to Python development instead of redoing Perl. Ah... Slashdot. Jeff has committed "a primitive first cut of a new Make system", which looks interesting.

A couple of weeks ago, Dan asked people to look into specs for various virtual machines, and the TCL machine was one of them. This week John Porter gave us an overview of how that worked, along with a list of ops and some explanation.

Brian Wheeler ticked 'Three arg chopn' off the parrot TODO list, and Simon Glover wrote some tests for it.

Dan took a moment to thank Bryan Warnock for his stalwart work on the earlier incarnation of the Perl 6 summary.

Erik Kidder told us he planned to add the undocumented ops to the parrot assembly PDD and Dan asked him to hold off on that thought while he had a look at those ops.

Dan says that Parrot_warn should handle a NULL interpreter by sending the error to the standard error location. Patches welcome.

John Douglas pointed us all at

The PMCs formerly known as ParrotPointer, ParrotSub and ParrotCoroutine are now known as Pointer, Sub and Coroutine.

Leon and others are doing interesting things with imcc. I'm not entirely sure what imcc is. Kudos will be awarded to anyone who furnishes me with an explanation I can use in the next summary.


This summary was brought to you during the journey between Newark upon Trent and London. Thanks are due (for this week and last week and hopefully in time to come) to Pete Sergeant, proofreader extraordinaire. Any errors, omissions and faux pas are, of course all Pete's fault.

If you have enjoyed reading this summary, or found it useful, drop me a line and let me know, feedback is great. If you think this is worth some of your hard earned cash, then visit and help to support Larry and Dan's work on Perl 6 and Parrot.