This week on Perl 6, weeks ending 2003-01-05

Hello, and welcome to the first summary of 2003; welcome to the future. This summary covers two weeks, but they’ve been quiet what with Christmas and the New Year’s.

So, starting as usual with perl6-internals

A Pile of Patches to the Perl 6 Compiler

Joseph F. Ryan submitted several patches to the Perl 6 mini-compiler, (found in the languages/perl6 subdirectory of your friendly neighborhood Parrot distribution) mostly implementing the the semantics for string and numeric literals discussed on perl6-documentation.

Garbage Collection Headaches

Heads have been put together in an attempt to get Parrot’s Garbage Collection system working efficiently and accurately (no destroying stuff before anyone’s had a chance to use it, damn it!) It appears that there’s still a good deal of head scratching to be done in this area (the chaps over on the LL1 list are wondering why we aren’t just using the Boehm GC system … .)

I freely admit that GC makes my head hurt (especially as, in my current Perl 5 project, I’m busy implementing mark and sweep collection for a persistent object store while also making sure that my random assortment of circular data structures has weakened references in just the right places so that stuff gets destroyed but only when it should be destroyed … . Boy, am I looking forward to Perl 6 and not having to worry about this stuff ever again … .) but I I’ll have a go at summarizing the issues.

The main problem appears to be that of ‘Infant mortality,’ an issue that I will now attempt to explain.

All the objects in memory can be represented as nodes in a graph, and the pointers between those objects can be represented as edges in that graph. The process of garbage collection involves taking a subset of those nodes (the rootset) and freeing (or marking as freeable) all those nodes in the graph that are unreachable from the rootset.

Now, consider a function that sets up a new PMC, specifically a PMC that contains another PMC. The first step is to grab the memory for our new PMC. Next, we create the contained PMC, a process that allocates more memory … and there’s the rub. Garbage Collection can get triggered at any point where we go to allocate more memory; unless the containing PMC is reachable from the rootset then it will get freed at the point. And that leads to badness. So the Infant Mortality problem can also be thought of as the problem of rootset maintenance. Which is, in theory, simple; just treat all C variables as members of the rootset. However, in practice it isn’t that simple, mostly because hardware registers complicate the issue.

Steve Fink offered an overview of the issues and some of the possible approaches to dealing with them, which sparked a fair amount of discussion among those who understood the issues.

http://groups.google.com/groups?threadm=a05200f07ba2d0834cfdf%40%5B63.120.19.221%5D

http://groups.google.com/groups?threadm=20021231000055.GA23896%40foxglove.digital-integrity.com – Steve’s overview

Variable/value vtable split

Leo Tötsch posted a summary of where we stand on doing the variable/value vtable split, suggesting that he wanted to start feeding in patches soon. Mitchell N Charity supplied a handy dandy ‘context’ post with links to appropriate articles, and he and Leo did a certain amount of thrashing out of issues.

http://groups.google.com/groups?threadm=3E1067FF.5030307%40toetsch.at

http://groups.google.com/groups?threadm=200212310239.gBV2dC524913%40vendian.org

Parrot Gets Another New Language

Ook! Jerome Quelin offered an implementation of the latest silly language, Ook! which can be thought of as brainf.ck for librarians. Due to insanity, the Ook! compiler is implemented in Parrot assembly, and emits Parrot assembly, too, which led Jerome to ask for an ‘eval’ opcode that Leo promised to supply – and which Dan specced out in PDD6. All of which led Leo to comment that, for all these languages are toys, they do seem to be driving the implementation of important bits of Parrot. Nicholas Clark reminded everyone that a zcode interpreter would be another good thing to have a crack at because it would require a couple of other really useful bits of Parrot functionality. Ook! is now in the core.

http://groups.google.com/groups?threadm=rt-19610-46602.16.0961486583524%40bugs6.perl.org

Returning new PMCs

David Robins wondered what was the resolution about creating and returning a new PMC in PMC ops that take a PMC* dest parameter. He and Dan discussed it back and forth and it became apparent that Dan really needs to get Parrot Objects defined … .

http://groups.google.com/groups?threadm=Pine.LNX.4.44.0212311324290.2659-100000%40davidrobins.net

Fun with PerlHash

Jerome Quelin noticed that you couldn’t delete an item from a PerlHash. Leo fixed it. Jerome later asked how one could retrieve the keys of a PerlHash in Parrot assembly and wondered whether there was a way to traverse a hash. Sadly, the answer is ‘not yet,’ but happily Aldo Calpini has something nearly ready for prime time.

http://groups.google.com/groups?threadm=200301021757.35942.jquelin%40mongueurs.net

GC/DOD feedback & runtime tuning

Dan has been playing some test programs and has found some major issues with resource allocation and added his stress-test programs to the distribution so others could see whether they could see how to fix things. Leo Tötsch (who else) made some inroads, reporting his progress to the list as he and Dan discussed ways forward.

http://groups.google.com/groups?threadm=a05200f17ba3a6adff185%40%5B192.168.3.1%5D

Object Semantics

Dan posted a sketch of how Parrot was going to deal with language level objects. And there was much rejoicing. Various people pointed out that Dan’s assumption that ‘real’ languages only had reference type objects was incorrect; ruby has value types, so does smalltalk and C# and they’re just the ones off the top of people’s heads.

http://groups.google.com/groups?threadm=a05200f16ba3a5968d9a6%40%5B192.168.3.1%5D


Meanwhile in perl6-language

Not much was happening. The language folks seem to have taken their holidays seriously; the last fortnight saw all of 76 posts.

Tree-Frobbing Facilities in Perl 6

Rich Morin wondered what type of facilities Perl 6 would have for monkeying about in trees, offering a discussion of the sort of thing he wanted to do and the problems he saw with doing that in Perl 5. Michael Schwern reckoned that “Doctor, it hurts when I do this.” applied (“Well, don’t do that then”) and suggested other ways to handle Rich’s problem. Simon Cozens, who should know better, made a terrible joke about frobbing trees. Dave Whipp pointed out that continuations should make it easy to treat tree traversal just like traversing any other list.

http://groups.google.com/groups?threadm=p05200f0dba2db8832a47%40%5B192.168.254.205%5D

PRE/POST in Loops

Arthur Bergman is this week’s hero. He’s busy writing Hook::Scope, which will (eventually) implement Perl 6’s PRE/POST/FINALLY/CATCH etc. In Perl 5. Yay Arthur.

Anyway, Arthur wanted to know what happens with POST and PRE in loop scopes. Do they get called for every iteration, or merely at the beginning and end of the loop?

Luke Palmer reckons that POST gets executed for every iteration (NEXT doesn’t get executed on the last time through a loop.

http://groups.google.com/groups?threadm=F41A933B-1E7E-11D7-BEB2-003065D64CBE%40cpan.org


my int ( 1..31 ) $var ?

Murat Ünalan didn’t like Damian’s proposed my $date is Integer(1..31); (restricts $date to an integer between 1 and 31) and proposed using my int(1..31) $date instead. He didn’t like

    my int ($pre, $in, $post) is constant = (0..2);

either, proposing either of:

    my constant int ($pre, $in, $post) = (0..2);
    my int is constant ($pre, $in, $post) = (0..2);

Murat argued that ‘type and property’ belong together. Damian disagreed, and pointed out that, if you want the specifiers close together, then you could write:

    my ($pre, $in, $post) returns int is constant = (0..2);

I’m caricaturing (but only slightly) the rest of the discussion if I say that the rest of the thread ran along the lines of a pantomime argument (“Oh yes it is!” … “Oh no it isn’t!”), suffice to say I don’t think either Damian or Murat convinced the other. Personally, I’m on Damian’s side – sorry Murat.

http://groups.google.com/groups?threadm=000001c2b32b%24c4cb0400%246a00fea9%40Platin

http://groups.google.com/groups?threadm=000001c2b382%24f4bfb500%246a00fea9%40Platin

Variable Types vs. Value Types

Dave Whipp wondered whether the type of a variable could vary independently of its value. I’m not sure I understand what Dave was driving at, which makes summarizing his post a little tricky (but I think there’s confusion about the meaning of ‘type’; A variable has what I will call a ‘sigil type’ and may also have a more specific ‘declared type’. Thus, a declaration of the form my Array $foo; declares a scalar (sigil type) variable which points to (contains) an Array (declared type) object while one of the form my Array @foo; declares an array (sigil type) variable which contains a number of Array (declared type) objects. The meaning of my Array %foo.

This led into a discussion of the ‘Everything is an object’ principle, but more on that next week.

http://groups.google.com/groups?threadm=20030103004227.16970.qmail%40onion.perl.org


In Brief

Leo Tötsch kept up his staggering patch generation rate. Does he ever sleep?

Mitchell Charity supplied a script which generates a browseable list of Parrot file names with brief descriptions, which should prove useful to new developers who want to get a feel for the layout of Parrot. Dan agreed, and it’s in the Parrot distribution now as tools/dev/extract_file_descriptions.pl.

Jason Gloudon got Garbage collection working on IA-64 Linux, yay Jason.

Bruce Gray sent in a bunch of cleanup and win32 patches.

On a suggestion from Mitchell N Charity, Robert Spier has started work on getting a browseable, cross-referenced version of the Parrot source up on perl.org and asked to be pinged in a week or two if it hasn’t happened.

Jerome also improved the debugger.

Leon ‘bear of very little brain’ Brocard added a couple of wishlist items: Objects, and a ‘make install’ that does something sensible.


Who’s Who in Perl 6?

Who are you?

A twenty-something coder, writer and editor who thinks it’s possible to improve the state of software and software development.

What do you do for/with Perl 6?

Random stuff:

  • argue language features with Allison, who lives very nearby
  • proofread documentation when I’m trying to read it
  • extending Parrot as an embedded platform for game scripting
  • overseeing the project to turn p6d documentation into executable test cases

Maybe I need a Perl 6 Test Pumpking hat …

Where are you coming from?

Physically, Portland, Ore., or Sebastopol, Calif.

Otherwise, I find that Perl 5 fits the way I think and expect Perl 6 to do the same, only much more so.

When do you think Perl 6 will be released?

In beta form within the next two years. Within five years, I think it will overtake Perl 5. (I expect a 5.12, though.)

Why are you doing this?

Someone has to do this. I’m blessed to be in a position where I have some ability to give back to the community that’s given me so much and where I have financial compensation to spend some time participating in this community.

I also believe that the way to write high-quality software is to take quality seriously. We have the opportunity to test Perl 6 from the ground up, having learned lessons and built tools for Perl 5. If we do our job correctly, then we’ll even have tests in place before we have the language features in place. Hooray for test-driven development!

You have five words. Describe yourself.

I am not really Schwern.

Do you have anything to declare?

So this camel and parrot walk into a bar…


Acknowledgements

Back to writing summaries on the train and in the armchair when I get distracted by almost anything (current distractions, writing a graphical TestRunner for the ObjcTest framework, Eliza Carthy’s utterly wonderful Anglicana CD and the nsNet puzzle game…). I started writing this Monday morning damn it.

Proofreading was once more handled by Aspell and me.

Thanks to chromatic for answering the questionnaire for me. The queue now has one (count it, one) entry left in it so please consider sending me your answers to mailto:mailto:5Ws@bofh.org.uk

If you didn’t like this summary, why are you still reading it? If you did like it, please consider one or more of the following options:

The fee paid for publication of these summaries on perl.com is paid directly to the Perl Foundation.

Tags

Feedback

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