This week on Perl 6 (8/26 - 9/1, 2002)

Well, it has been a week. Damian came to London and made our heads spin; perl6-language erupted in a flurry of interesting, high signal/noise threads; Parrot reached its 0.0.8 release; Larry made many of his wonderfully unexpected but obviously right interjections and the world kept on turning.

So, we’ll kick off with perl6-internals as usual.

DOD etc

The ‘elimination of garbage collection hand waving’ thread continued as Nicholas Clark asked a hard question about garbage collection and dead object detection (DOD). As far as Nick could tell, it seems that ‘if we have unrefcounted “deterministic destruction” objects somewhere freely in the GC system, then we’ll be needing a DOD run after every statement’ and he noted that ‘all ways of doing deterministic destruction seem to have considerable overhead.’ Sean O’Rourke wondered whether we could use a hybrid ‘full GC + refcounts where needed’ scheme, but Juergen Boemmels pointed out that refcounting would be contagious. Anything that contained a reference to a refcounted object would need to be refcounted in its turn.

Meanwhile, Mike Lambert wondered why we needed to promise deterministic destruction in the first place and proposed a couple of schemes to deal with the canonical ‘filehandle’ case. Sean O’Rourke and Steve Fink both came forward with cases where deterministic destruction proved useful, and where Mike’s scheme didn’t really work. And that’s where the thread came to rest. I have the feeling that it, or a thread like it, will be back.

http://makeashorterlink.com/

Dynamic Keys

Tom Hughes, who has been doing good work on keyed access wondered about dealing with dynamic keys, and proposed a way forward. Dan asked whether Tom had looked at the proposed ops in PDD06, and pointed out that dynamic keys didn’t necessarily need to go the whole PMC hog. ‘They’re our internal structures – we can screw with them as we need :)‘. Tom pointed out a few issues with the PDD06 op set, and proposed a few more ops with a (hopefully) consistent naming scheme. So far he’s had no answer to the questions he raised in that post.

http://makeashorterlink.com/

Perl6 Test Failures

Steve Fink wondered about all the test failures he keeps seeing for Perl 6; he doesn’t want to go trying to make a language neutral regex engine play nicely with the Perl6 engine when that engine is in such a state of flux. Sean O’Rourke suggested nailing down some calling conventions and then both teams could code to those conventions. Steve pointed out that, so far, he knows of at least five attempts at a regex engine in parrot. Leopold Toetsch suggested that Steve try the tests again, forcing a grammar rebuild, and the test failures got all better.

http://makeashorterlink.com/

Regex status

On Wednesday, Dan wondered where we were with Apocalypse/Exegesis 5 compatible patterns/rules/regexes. Sean O’Rourke told him. (Answer: Still some way to go, but making good speed.)

http://makeashorterlink.com/

Counting down to 0.0.8

On Thursday, Jeff Goff posted his timetable for 0.0.8, ‘Octarine’ release of Parrot, complete with a 25-hour code freeze. Markus wondered whether using a GMT timetable might be more friendly for everyone who wasn’t on the East Coast of the United States. Parrot actually saw release Monday, Sept. 2, which is slightly outside the scope of this summary, but I’ll let it sneak in anyway.

http://makeashorterlink.com/

http://makeashorterlink.com/

An ‘Oops’ Moment

Leopold Toetsch found an interesting bug with the GC system interacting with initialization. examples/life.ar.p6 is a Perl6 implementation of Conway’s Life, which has a rather lengthy initialization phase, after which it checks the @ARGS array, which is conventionally placed in P0 at startup. But there’s a catch. By the time it comes to make the check, @ARGS has been garbage collected. Peter Gibbs posted a quick fix patch, and Mike Lambert stuck his hand up to being a ‘lazy bum,’ but reckoned that Steve Fink’s fixes should solve the problem.

http://makeashorterlink.com/

Various changes to IMCC

Whilst ‘idly toying’ with IMCC, Steve Fink made a bunch of speculative changes, bundled ‘em up in a patch and offered them to the list. I’m not sure what people thought of the changes, but the thread morphed into a discussion of generating conditional makefiles and making sure that IMCC and the other tools needed to get the Perl6 compiler working were as portable as possible. Mike Lambert pointed out that it may make sense to have the files generated by bison/flex checked directly into the repository, since then those tools wouldn’t be needed except by people who go messing with the grammar.

http://makeashorterlink.com/

Concatenation Failing

Leon Brocard (phew, I was worried I was going to have to run his questionnaire this week) found a bug where concatenation fails occasionally, leaving no clues as to why. He attached some sample code that illustrates the problem. Peter Sinnott noted that Parrot seems to be getting confused about the length of the strings involved. Meanwhile, Peter Gibbs offered a patch and Mike Lambert reckoned it fixed a bug in his code, but couldn’t for the life of him work out why. Peter reckons it has to do with unmake_COW resizing the allocation and causing confusion elsewhere. I get the feeling that what we have now is a ‘symptomatic’ fix in search of a fix for an underlying issue. But I’m just a summarizer.

Markus Laire found what he thinks might be another bug, but I’ve no idea if it’s fixed by Peter Gibbs’ patch.

http://makeashorterlink.com/

http://makeashorterlink.com/

IRIX64 alignment problem

Steven McDougall chased down a bug causing t/pmc/perlhash.t to throw a bus error, but wasn’t at all sure how to go about fixing it, and asked for advice. Bryan C. Warnock offered a few pointers, as did Peter Gibbs, but we don’t have a fix yet.

http://makeashorterlink.com/

Meanwhile, in perl6-language

Prototypes, grammars and subs, oh my!

Thom Boyer wondered what while’s signature would be. He’d considered sub while (bool $test, &body); and sub (&test, &body); but neither really fit. Larry agreed and offered

    sub while (&test is expr, &body);

and then, reaching deeper into his bag of tricks, he pulled out the wonderful/scary

    sub while (&test is rx/<expr>/, &body);

(Think about that for a moment. What is proposed that you’ll be able to specify a grammar for your functions argument list, which is definitely something that made me sit up and take notice.) Damian sat up and took notice, too, offering some refinements and doing some thinking aloud. Damian suggested that maybe the prototype should look like sub while ( &test is specified(/<Perl.expr>/), &body); >>. Damian also suggested blurring the line still further between statements and expressions by having the likes of C<for> return a value, and had some thoughts on multimethods. Trey Harris also offered some more comments on multimethods.

All of which leaves me looking forward with bated breath for Apocalypse 6.

Quote of the thread: “The whole point of making Perl 6 parse itself with regexes is to make this sort of stuff easy.” – Larry

http://makeashorterlink.com/

http://makeashorterlink.com/

Rule, rx and sub

Deborah Ariel Pickett summarized the state of her understanding of the difference between rule and rx and wondered if there was any case where

    ... rule ...

and … rx …

(given the same ...s in both cases), lead to valid, but different semantics. Uri Guttman thinks not. Damian thinks so, and provided an example. (It was joked, on the London.pm mailing list (by Damian himself) that Damian is currently our only real, live Perl6 interpreter.). Luke Palmer raised a red flag about Damian’s example; Damian thinks it wasn’t a red flag, but left it to Larry to adjudicate. This also provoke a certain amount of discussion about the philosophy behind some of the design decisions so far.

Glenn Linderman wondered whether rx shouldn’t be respelled, as the term ‘regex’ is being deprecated. Damian suggested that rx actually stood for ‘Rule eXpedient’, but I’m not sure he convinced anyone (himself included). Ever the linguist, Larry observed that ‘we can tweak what people mean by “regular expression”, but there’s no way on earth we can stop them from using the term.’ and that, no matter how many editions it goes through, Friedl’s book is always going to be called Mastering Regular Expressions. So, Larry is ‘encouraging use of the technical term “regex” as a way to not precisely mean “regular expression”.’

Piers Cawley raised a question about when } terminates a statement and got it wrong. This subthread led to a short discussion on good Perl 6 style. Damian told us that ‘Any subroutine/function like if that has a signature that ends in a &sub argument can be parsed without the trailing semicolon’, which I don’t remember seeing in any Apocalypse. This led to a discussion about what was legal in a prototype specifier, ending when Larry told us that it’d be possible to specify a grammar as a function’s prototype.

http://makeashorterlink.com/

http://makeashorterlink.com/

http://makeashorterlink.com/

http://makeashorterlink.com/

Auto deserialization

At the root of what turned into a large thread, Steve Canfield asked a deceptively simple question: ‘[Will] code like this Do What I Mean: my Date $bday = 'June 24, 2002'’? We weren’t entirely sure what he meant by that…

The thread was long, and pretty much unsummarizable, but we ended up with the rather pleasant looking my Date $date .= new('Jun 24, 20002'), the idea being that, because $date is known to be a Date, even if it’s undefined, then it’s possible to make a static method call on it. The response to this suggestion spilt over into the next week, but ‘favourable’ would be a good description of it.

http://makeashorterlink.com/

http://makeashorterlink.com/

Hypothetical synonyms

Aaron Sherman wondered if he would be able to write

    $stuff = $field if m{^\s*[
        "(.*?)"     {let $field = $1} |
         (\S+)      {let $field = $2}]};

Larry thought

    my $stuff;

    m{^\s*[
        "$stuff:=(.*?)" |
         $stuff:=(\S+)
    ]};

was a better way of doing it, saying that he saw no ‘particular reason why a top-level regex can’t refer to variables in the surrounding scope, either by default, or via a :modifier of some sort.’

Uri Guttman, in possibly the first ever Perl 6 golf post (he denies it’s really golf), suggested a way of shortening the pattern further, and Larry trumped him by shortening it to my $field = /<shellword>/, which led Nicholas Clark to wonder about oneliners along the lines of my $data = /<xml>/ and wondered if the Perl regex engine would be faster than using expat. Nick also wondered if Perl 6 would give shorter golf solutions than Perl 5.

There was quite a bit more in this thread, but my summarizing skills are failing.

http://makeashorterlink.com/ – Thread starts here, it’s jolly good.

Does ::: constrain the pattern engine implementation

Deven T. Corzine wondered if the presence of ::: and friends in the pattern language meant we’d constrained the possible implementation of the pattern engine before we’d started, and if we could implement something that didn’t do backtracking. General opinion seemed to be that we couldn’t avoid backtracking, but Deven wondered if it wouldn’t be possible to use a non backtracking implementation for some special cases. The consensus appears to be ‘If you build it, and it’s faster, we will come’.

http://makeashorterlink.com/

Backtracking into { code }

Ken Fox wondered if

  rule expr1 { <term> { /@operators/ or fail } <term> };

and

  rule expr2 { <term> @operators <term> }

were equivalent. Damian thought not, and added that expr1 should probably be rewritten as rule expr1 { <term> { m:cont/@operators/ or fail } <term> }. Larry says that we will backtrack into subrules.

Again, the whole thread is worth reading if you’re interested in the rules/patterns/regex engine.

http://makeashorterlink.com/

Prebinding questions

Philip Hellyer asked a bunch of questions sparked by Damian’s talk about Perl 6 to London.pm (at the Conway Hall no less, London.pm knows how to find appropriate venues). Damian answered them.

http://makeashorterlink.com/

@array = %hash

Nicholas Clark noted that @array = %hash, for a hash of n elements would return an array of n pairs. The Perl5 style, returning a list of 2n elements, keys and values interleaved would be @array = %hash.kv. All this led Nick to wonder what happened in the other direction. Obviously %hash = @list_of_pairs was going to do the right thing, but what about %hash = @kv_array. And, more worryingly, what about

   %hash = ("Something", "mixing", pairs => "and", "scalars");

It turns out that the @kv_array case will Just Work, and the last case will cause discussion to break out. Damian thought that the example above would throw an error because there are 5 elements in the list. Another school thought that, because PAIRs are first class objects in Perl 6, the code should work, with one of the keys of the hash being the pair (pairs = ‘and’)>. Damian thought not, and discussion ensued. I’m afraid I’m not entirely well qualified to summarize this thread as I’m one of those who thinks Damian is wrong, or at least, not yet sufficiently correct. However, for now, the state of the design is such that pairs are ‘special’ and it takes an effort of compile time will to use them as keys (or values come to that) in a hash.

http://makeashorterlink.com/

Regex stuff

Choosing a deliberately vague subject line in an effort to give the summarizer a headache, Piers Cawley asked a question about binding to numeric hypotheticals. It turns out that binding to a numeric hypothetical variable in a regular expression is special cased (resetting the numeric ‘counter’) and even mentioned in the appropriate apocalypse, and the problem that Piers thought he saw doesn’t actually exist.

http://makeashorterlink.com/

Atomicness and \n

Aaron Sherman wondered what \n would be translated to in a Perl 6 pattern. Aaron proposed <[\x0a\x0d...]+>. Damian thought it was <[\x0a\x0d]>, and Ken Fox thought it would be something like \0xd \0xa | \x0d | \x0a. Personally I think it’ll be [ \0xd \0xa | <[\x0a\x0d...]> ]. (I also believe that whoever came up with the idea of a two character end of line marker should be taken out and shot, but that’s another story entirely).

The news from London

On Thursday Damian managed to deliver his Perl 6 prospectus talk in about 3.5 hours. Okay, it sounds like a long time, but Damian told us that, on average, the talk runs to 5 hours. The ‘one question’ rule introduced by London.pm seems to have worked well. As predicted a whole load of lights went on over peoples heads as they started to ‘get’ how the whole thing hung together.

Anyway, the one question rule led to a bunch of questions about Perl 6 cropping up on the London.pm mailing list that haven’t (yet) been cross posted to perl6-language. One interesting question concerned what happens when bare/if/while/do/when/etc blocks have return in them. Damian answered that they throw a ‘return’ control exception, which the control structure catches and re-throws. Piers wondered how you’d go about writing your own looping construct and made a couple of proposals about the treatment of control exceptions.

Quote of the London.pm threads: ‘yImoj Perl javDIch!’ which, as everyone knows, is the Klingon for ‘Be Perl6. Now!’.

http://makeashorterlink.com/

http://makeashorterlink.com/

Call for assistance

Next week is the Zurich Perl 6 mini conference, and I won’t be there. Soon after that is YAPC::Europe 2002, and I won’t be there either. This week, Damian is in Belfast and will be talking to Belfast.pm about stuff, guess what, I’m not there either. If anyone would like to send me some Perl 6 related reports for the summary from any of these events I would be enormously grateful. Thanks in advance.

Squashing a myth

You may have come across the ‘Damian Conway is looking for graduate students’ meme. I know I have, and I repeated it at one of Damian’s talks in London. Guess what, it’s not true (as I should have realised). Damian is no longer associated with any institute of higher learning and is not looking for graduate students. Kindly readjust your memeplexes.

In Brief

Pete Sergeant pointed us all at some work he’d done toward building an ‘operations dictionary’ for Parrot. Available at http://grou.ch/parrot/index.cgi.

Over the course of a surprisingly long thread, Steve Lambert, Markus Laire and Leopold Toetsch and a few of the usual suspects got IMCC and Perl6 compiling properly with Windows.

Bryan C. Warnock offered a large patch to parrot’s glossary.pod; a document worth reading. Bryan also PODified byteorder.dev so it would show up correctly on http://www.parrotcode.org/docs/. Bryan also added POD title blocks to a pile of PODs. Kudos to the docmonster.

Daniel Grunblatt added conditional breakpoints and watchpoints to the Parrot Debugger. Steve Fink also waved a magic wand over the debugger and fixed up a bunch of problems. Well done chaps.

Andy Dougherty wondered about how up to date MANIFEST is. There were 497 files listed in MANIFEST, but a fresh CVS checkout runs to 2215 files. Daniel Grunblatt thinks he’s added all the important files to MANIFEST.

Sean O’Rourke made some big changes to IMCC; newlines within statements are no longer allowed, and there’s been some ‘significant changes to register allocation and spilling.’

Bryan C. Warnock wondered about the file permissioning inconsistency in the parrot source tree. Andy Dougherty pointed out that it wasn’t (quite) as inconsistent as it looked; build scripts should be left without execute bits so that makefile authors would use the more portable $(PERL) script.pl, which makes no assumptions about the whereabouts of perl.

Peter Gibbs offered a huge patch, merging his ‘African Grey’ parrot tweaks with the CVS parrot. It’s not been applied in CVS, but http://makeashorterlink.com/ has the details.

Jason Gloudon wondered about temporary PMCs used in opcodes like < ADD Px, Py, Pz>, and wondered what set_pmc should do in the simple case. Sean O’Rourke pointed out that often one wouldn’t need to create transient PMCs because one could use the specialist string and number registers to hold the temporaries. Sean voted for ‘morph’ in the simple set_pmc case.

Jonathan Sillito contributed a patch allowing for hierarchical lookup of lexical variables in scratchpads, and which makes subroutines into real closures (by virtue of the hierarchical lookup up of lexical variables…). Warnock’s Dilemma applies…

Andy Dougherty did some cleaning up of the build process, removing lint and cruft from the Makefiles and Configure.pl. Hmmm… I wonder how far we are from our goal of ‘compile a miniparrot, use that to execute the more advanced config script, and then compile the full parrot’, and removing the dependency on Perl to build parrot…

Now that we have ICU in the repository Angel Faus wondered how we should deal with differently encoded strings. No answers yet.

Andy Dougherty wondered if the time had come to make IMCC build with plain old yacc and lex instead of depending on bison and flex. Leopold Toetsch reckoned that that would be a good idea and asked Andy for his patches.

Leopold found a bug in mul, div, mod, sub, concat when operating on PMCs. So he fixed it. I’m not sure if the patch has been applied.

Jürgen Bömmels got fed up with MANIFEST not being accurate. So he wrote an automated test which compares the MANIFEST with CVS/Entries and complains if they don’t match. I don’t know if it’s been checked in yet, but when it does, let’s hope the committer remembers to update the manifest.

Steve Fink has a patch which stops Configure.pl touching files unless they’ve actually changed, and wondered if it would be of any use to people not actually working on Configure. Nicholas Clark took the opportunity to point us at http://ccache.samba.org/.

Steve Fink also submitted a flurry of clean up patches, many of which look like they’ll get applied once 0.0.8 has been released.

Dan noted that Hashes are an order of magnitude slower to GC than, say PerlStrings, and two orders of magnitude slower than PerlInts. Which isn’t good. Dan wondered if there might be a way to get less GC overhead. Steve Fink offered a few suggestions.

‘:/::/:::/<commit> makes backtrack fail current atom/group/rule/match.’ – Markus Laire summarizes the various backtracking assertions.

Who’s who in Perl 6

Who are you?

Miko (pronounced “Mike-Oh”) O’Sullivan, Father of Melody, Husband of Starflower, Follower of Jesus, Author of The Idocs Guide to HTML

What do you do for/with Perl 6?

Participate in perl6-language, generally by suggesting small features that I think would make life a lot easier for programmers.

Where are you coming from?

I come from the perspective that a) I want things to just work without a lot of startup effort on my part b) I believe that things can in fact actually do that c) Perl does d) Perl can do so even more e) I’m pretty normal in these feelings. Oh, also Blacksburg, VA, USA.

When do you think Perl 6 will be released?

Put me down for June 6, 2003, 1:37:03 am EST.

Why are you doing this?

I’m sort of like a Lab (i.e. the dog) that instinctively jumps into a lake: I just must do it.

You have 5 words. Describe yourself.

Impatient.

Do you have anything to declare?

I declare a lot of public static constants.

Acknowledgements

Thanks to Gill for putting up with me last night while I sat and pretty much ignored everything as I worked on this summary. For some reason, perl6-language threads are much harder to summarize well; I always take longer to write a summary when that list is busy.

As usual, if you liked this summary, please send money to the Perl Foundation at http://donate.perl-foundation.org/ to support the ongoing development of Perl.

This week’s summary was funded by the O’Reilly Network, who now pay the publication fee for the summaries directly to the Perl Foundation. So, a big thank you to them.

Tags

Feedback

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