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

The Perl 6 Summary for the week ending 20030518

Welcome back to another Perl 6 summary, this week without any 'comic' introductions.

So, without further ado we press straight on to the happenings in perl6-internals.

Makefile issues

Bruce Gray sent in a patch to tweak Parrot's Makefile to ensure that IMCC could be built before doing either make test or make static. The various executables in the Parrot distribution now link against libparrot.a instead of just linking a bunch of .o files. Steve Fink liked the idea, and made a few other suggestions (building IMCC by default, having make test run the IMCC tests...). The patch was later applied by Bruce after Steve Fink gave him committer superpowers.

Even more on stack walking

The discussion of garbage collection and timely destruction came up again. Essentially, we want to have our cake and eat it too.

Here's some background. Consider the following piece of code:

    sub iterate_over_file {
        my($filename, $code) = @_;
        open my $fh, '<', $filename or die;
        &$code($_) for <$fh>;

Unless I'm going mad, this should be legal code in both Perl 5 and Perl 6. Now, consider what what happens when execution leaves the iterate_over_file function. In Perl 5 the file handle in $fh has its reference count decremented and, because there are no remaining references, the file is closed and the filehandle is destroyed. In a Perl 6 with no 'special case' garbage collection added, nothing happens. $fh only gets closed when a Dead Object Detection (DOD) run is triggered, which need not happen for a while, potentially leading to resource leaks or locking issues or other unforseen consequences.

One way around this is for classes whose objects need timely destruction to tell Perl that there are some of its objects floating about so that Perl can trigger a DOD run at the end of every scope until there are no more such objects floating around. But that could be expensive (as Luke Palmer demonstrated with a neat piece of pathological code). Luke suggested a scheme where variables would have a needsDOD property (or some such thing) and a DOD would be triggered at the end of any scope that contained such a variable. Benjamin Goldberg offered a suggestion for a hybrid reference counting/full GC scheme.

Garrett Goebel pointed out that the details of how Perl 6 implements this are really irrelevant at the moment; Dan has said there will be a way to trigger a DOD run at any time, which means that Parrot should support whatever scheme the Perl 6 implementers come up with.

BASIC gets fancy

Clinton A. Pierce announced that the compiled version of BASIC under languages/BASIC/compiler now supports the QuickBASIC style COLOR, LOCATE and CLS statements. These additions prompted Leon Brocard to post a colour version of mandel.bas which generates a colour representation of the Mandelbrot set.

More sub/method call stuff

Dan announced that now we know what the calling conventions will be, we should look at how we should make calls to parrot functions. He outlined a continuation passing style approach which looks like it should have all the right magic.

Hmm... I just tried to write a short description of continuation passing style and ended up duplicating most of Dan's post, but not so well written, you're better off reading that.

The general response to this was positive (once people had got over boggling at the idea of data encapsulation in an 'assembler').

There was also some discussion of how continuations, tied variables and hypotheticals would interact (answer: We don't know yet, but it looks interesting...)[]

Indexing registers or something

Klaas-Jan Stol wondered about adding some way of doing register based indirect addressing (as Dan called it), which would allow for iterating over a set of registers in a loop (amongst other things). Dan suggested a couple of ways of doing it, but wanted a usage case for compiler-generated code before he went implementing anything. Klaas-Jan suggested a Lua construct that's analogous to the Perlish ($a, $b, $c) = (f(), g(), h()) as an example of where such code would come in handy. Luke Palmer suggested a way of implementing that in code that wouldn't need the indirect register addressing, and noted that if indirect register addressing were implemented then IMCC would probably get very confused indeed.

Socket IO

Andrew The has been working on getting Socket IO working in Parrot, implementing a thin layer over the BSD socket functions and he had a few questions about the official way to do some things. Leo Tötsch answered some questions, and suggested that Andrew liaise with Jürgen Bömmels, who is working on Parrot's IO layer.

Using vtable macros

Leo Tötsch offered a couple of scripts to convert a Parrot distribution to use the new VTABLE_* vtable macros (it's done as a script because some many people have their own collection of patches in place, so a simple CVS commit doesn't catch all the vtable accesses).

Disable unused vtable entries

Leo Tötsch proposed disabling all vtable methods that are either unused or not covered by opcodes. He reckons that this should make changes to the class hierarchy and vtable layout much simpler. Warnock's Dilemma currently applies.

String->number problems

Clint Pierce noticed that

    set S1, "Not really a number 2"
    set N0, S1
    print N0

gets its string to number conversion wrong and outputs 2.00000 rather than the expected 0.00000. Luke Palmer patched it, but Benjamin Goldberg pointed out a few problems to do with string encodings.

Fixes to Parrot::Test

Bruce Gray tracked down and fixed some problems with make test seeing fake test failures, which turned out to arise from two interacting bugs in Parrot::Test

Switched run core

Leo Tötsch supplied a patch to add a switched prederefed run core to Parrot's menu of run core options. It's slightly faster than the plain prederefed run core, and Leo thinks it should be the default run core when the computed got and JIT cores are unavailable. Bruce Gray caught a problem with an embedded newline which broke a couple of the tinderboxes. As far as I know the patch has not yet been applied to the CVS distribution.

Meanwhile in perl6-language

The language list was quiet this week, with a grand total of 20 messages...


Steve Fink had some questions about function signatures and how they interacted with pairs. The upshot of his question was the reminder that if you want to pass a literal pair into a function you need to remember to put it in parentheses func(1, (a = 7))> or it will be interpreted as a named parameter, which will throw an error if there isn't an appropriately named parameter or a slurpy hash param.

The object sigil

Luke Palmer wants a sigil to explicitly disambiguate between a container and the thing contained (short circuiting any language level delegation) and proposed & as the appropriate sigil. I'm not entirely sure that you need anything more than \ and some carefully deployed parentheses. I also appear to have missed something as there seemed to be an assumption that in code like this

    for 1..Inf -> $x { ... }

then $x wouldn't be a simple scalar, but an iterator, allowing you to write $ in the body of the loop, which I have to confess is news to me.

Acknowledgements, Announcements and Apologies

Thanks to everyone for everything. Particular thanks to whoever chose both my talks for YAPC this year; I really should get around to writing them soon. And fixing the massive bug in the module that one of the talks is all about...

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


-- Piers