This Week in Perl 6, through August 2, 2005


In case you were wondering, Darwin ports didn't work its magic and I still don't have a working Haskell compiler. Thank Juerd for feather, even if I did have to turn my laptop upside down to read the MOTD. Rot-180: oN hes +snf

This week in perl6-compiler

There were 12 messages in the compiler list this week. Either everyone has decamped to IRC or OSCON, or the compiler's getting mature enough that most of the interesting discussion about it happens in perl6-language as Autrijus and others seek clarification.

Some Thoughts on PIL/Complete Type Inferencing

Autrijus has been doing some thinking on the next version of PIL (The Pugs Intermediate Language), which will be a little less tightly coupled with PIR/Parrot. He outlined his thinking (which he seems to have directed towards being able to do useful things and optimizations with Type information) in this thread.

Definition of Containers

Autrijus announced that he'd checked in the first part of the new PIL run core. In case you were wondering, containers are the things that Perl variables have as values. They're where things like tie magic happens.

Hoisting Variable Declarations

Hands up! How does the scoping of

 
   $x = $x + my $x if $x;
   #1   #2      #3    #4
}

work in Perl 6?

In Perl 5, all those $xs refer to the same thing. In Perl 6, #1 and #2 refer to $OUTER::x.

This behavior (lexical scopes really are lexical) makes a compiler writer's head hurt. Autrijus outlined a plan for making it work.

Meanwhile, in perl6-internals

Dominance Frontier

Curtis Rawls had posted a patch adding "dominance frontiers" to IMCC. (I'm afraid I don't know what a dominance frontier is, but it sounds like it might be fun.) This week, he wondered if someone could apply it any time soon, because he had another patch that depended on it.

It turned out that the patch broke a test or two, and Will Coleda, Andy Dougherty, Patrick, and Leo set about helping to track it down. It looks like they have found the issues, and work continues to fix them.

make languages Should Continue After Building a Language Failed

Have you ever looked through the Parrot Makefiles and wondered what the deal is with .dummy? If so, this thread explains everything.

PMC Syntax

Klaas-Jan Stol asked if there's any documentation on the complete syntax for .pmc files when writing PMCs. Apparently there isn't, apart from the source of pmc2c.pl, but Will Coleda and Leo helped Klaas-Jan out.

Embedding ParTcl

Thilo Planz had some problems embedding ParTcl into a PIR application. It mostly worked, but he had a few questions. Will Coleda helped out again.

Compiling Dynamic PMCs

Klaas-Jan had more questions about compiling PMCs--dynamic ones, this time. It appears that the docs he was following didn't quite reflect reality. Leo solved the problem and Klaas-Jan sent in a doc patch. Hurrah!

Parrot Cannot Start up if STDERR or STDOUT is Closed

Michael Schwern pointed out that Parrot won't start if you close either STDOUT or STDERR, eschewing the standard joke response ("Doctor, it hurts when I do this." "Well don't do that, then.") Jerry Gay wrote a test and Leo fixed it.

Accessing Hash with Strings/Keys

Apparently, Klaas-Jan is working on writing a Lua compiler to target Parrot. He's obviously working on it a good deal at the moment. :)

He wanted to know how he could extend the standard Hash PMC to return None if there is no key found. As is traditional in these cases, Leo helped him out. It turns out that part of the problem is that pmc2c.pl isn't that strict in its syntax checking. If anyone reading this has the tuits ...

Does It Cost Anything to Use a Big PMC Everywhere?

In a move guaranteed to gladden at least Dan Sugalski's heart, Amir Karger popped up to say that he's working getting the Z-machine interpreter working. He wondered if there was any way of dedicating a register to a particular constant in order to avoid copying a global every time he called a sub. Leo helped out.

Super!

Leo announced that he'd added a new Super PMC which will make it easier to call superclass methods.

Lua Project

Klaas-Jan unveiled his project to get the Lua compiler targeting Parrot. It's apparently "far from complete," but hey, it's good to welcome yet another language to the Parrot cage.

Announcing mod_parrot 0.3

Jeff Horwitz announced the release of mod_parrot 0.3, complete with support for all Apache hooks, autogeneration of request_rec methods, and a mod_pugs proof of concept. Crumbs. And there's more. Check out the announcement, download the code, and start making Apache do weird things. Go on, you know you want to.

Meanwhile, in perl6-language

The Use and Abuse of Liskov

Damian and Luke's discussion of the right way to do MMD looks to be finally winding down. It seems Luke's convinced Damian of the righteousness of his cause. (Or at least, if he's wrong, he's wrong in a subtler way than Damian realized.) I don't think there's been a final decision as yet, but we're definitely moving forward.

Slurpy Parameters and Auto-Flattening

Ingo Blechschmidt asked for some clarification of the behavior of slurpy parameters. It's not often I hope that Luke is wrong, but I really hope the answer he gave Ingo isn't the true state of things.

Exposing the Garbage Collector

Bah! I propose a simple, slow, yet powerful feature that is useful to implement a whole bunch of other possible APIs for getting at stuff, and people go and suggest making any one of various heavier APIs the One True API. It's enough to make a person despair.

Ah, apologies, I'm letting personal concerns get in the way of the summary, but what the hell, I'm leaving it.

Messing with the Type Hierarchy

Luke had a few things to say about what happens when you monkey with the type hierarchy, so he said them. The usual suspects joined in, most of them addressing the particular instance that Luke had chosen to illustrate his point, rather than discussing the broader point, but hey, this is perl6-language. That's what happens.

Luke's broader question was, "Should it be possible to write a class that isn't a leaf in the existing hierarchy?" The example that everyone addressed was the idea of writing a Complex class that wedged in between Real and Num in the hierarchy (which, as several people pointed out, isn't necessarily the right way to think about it anyway, hence the discussion).

My gut feeling was that the answer to the general question should be "Yes, but be very, very careful, and don't be surprise if it bites you later."

Elimination of Item|Pair and Any|Junction

The discussion of appropriate default prototypes and the like continued. Autrijus proposed a way of rejigging the type hierarchy to make default argument types a little clearer. I found things getting a little weird, to be honest--there's even talk of eliminating Object as a type name, which seems a little strange.

Execution Platform Object? Gestalt?

Randal proposed that, as the number of possible platforms that Perl 6 can run on proliferates, it'd be really handy if there were some useful global that held knowledge about the platform and its capabilities. He proposed $*OS as a decent place to put it. Larry thought we probably would have something like that, but thought that there might end up being two globals: $*OS and $*VM. The usual "Why don't we call it" thread sprang up, but it seems that the most important upshot is that this particular bike shed will definitely be painted.

The Meaning of returns

The continuing invasion by the rampaging hordes from p6c continued apace. This time, Autrijus had a discussion on the implications of returns and its implications for type inferencing.

Lazy List Syntax

Flavio S. Glock wondered how to go about creating a lazy list from an object. Apparently the magic he was missing was prefix:=, which is syntactic sugar for calling the .next method on anything that supports iteration, which is nice.

An Idea for Doing pack

David Formosa had an idea about a possible pack API; he outlined it on the list. Yuval Kogman seemed to like it, but there's been nothing from anyone else on the list.

Inferring (Foo of Int).does(Foo of Any)

Autrijus again, this time thinking about the kind of type inferences that Perl aggregate types allow. Once I had my head in the right space, it made a great deal of sense, even if:

Array of Item).does(Array of Int); # false
Array of Int).does(Array of Item); # also false!

made my head hurt the first time I read it.

Garbage Collector API

Various people proposed additions to the proposed Garbage Collector API.

$value.confess()

Brent Royal-Gordon had a cunning idea for debugging: having Perl 6 capture the call stack at its point of creation and stashing that in a property called confess, which he could examine in a debugging context to find out where a value came from. As he pointed out, this would be expensive, but useful. He's currently Warnocked, but I get the feeling it should be possible to write an extension to do what he wants without adding anything extra to Perl 6 itself. It might be a little tricky if he wants the call stack to change on mutation, though.

Slurpy is rw Arrays

Having received clarification of the behavior of normal slurpy arrays, Ingo Blechschmidt asked for clarification of the behavior of Slurp is rw arrays. Adriano Ferreira and Thomas Sandlaß seemed to talk sense in reply.

Curious Use of .assuming in S06

Autrijus wondered if code like:

&textfrom := &substr.assuming(:str($text) :len(Inf))

found in Synopsis 6 was a mistake, or if the syntax should be like that. It turns out that the syntax is supposed to be like that. Apparently being able to do without the commas was one of the reasons for making colon pair syntax look like that.

Laziness and IO

In a currently Warnocked post, David Formosa outlined a potential problem with lazy IO.

sub foo ($x) returns ref($x)

In his continuing discussion of the Perl 6 type system and the inferences that you can draw about it, Autrijus posted a discussion of how to declare that a function that returns a value with the same type as its argument. He suggested that the best way forward would be to declare something like:

sub identity ($x) returns ref($x) { ... }

and asked for better suggestions. Thomas Sandlaß had suggestions.

&say's Return Value

Gaal Yahas thought that &print and &say should fail on errors and return the printed string on success (but true). Larry thought not. It looks like they'll end up returning a Boolean or throwing an exception.

$arrayref.ref

Ingo continues his ongoing task of getting clarification of the semantics of a whole host of things. This time he wanted to know about the behavior of references. Larry clarified.

Binding Scalars to Aggregates

Next up in Ingo's clarification project was binding scalars to aggregates. (Or did he mean binding aggregates to scalars?) Again, Larry came through with answers. It turns out that there's more to this than meets the eye at first glance. Autrijus's post on containers over in perl6-compiler addresses some of these issues, as well.

Binding Hashes to Arrays?

Ingo asks, "Is it legal to bind a hash to an array, or vice versa?"

Larry answers, "Not at the moment."

Module Init Hooks and Pragmas

Gaal Yahas wondered what function in a module to call when you use or no it.

Warnock applies.

Eliminating &{} and *{}

Autrijus wondered if we really need the & sigil. Warnock applies.

Stringification of Pairs

For some reason, Ingo's shortest question ("How do pairs stringify?") attracted the largest response. Well, at first blush it looks like it did. What actually happened was that Warnock claimed it, but the References: header in Andrew Shitov's posed discussed below was a little broken.

zip with ()

Some strange behavior of zip caught out Andrew Shitov. Ingo explained the problem. There was quite a bit of discussion of the various subtleties exposed.

Sometimes I pity the poor swine who's going to have to write Programming Perl 6. It's going to make the current camel look like a slim volume, if we're not careful.

Mutating map and grep

Ingo Blechschmidt wondered if it was true that Perl 6's grep, map, etc., wouldn't allow mutating values in their source array. He wondered if it would be possible to use a pragma to get the old, Perl-5-ish, behavior back. Thomas Sandlaß wondered if simply explicitly declaring the given block's argument as rw wouldn't do the job. There is no word from @Larry yet.

Acknowledgements, Adverts, Apologies, Alliteration, and Conference Envy

Damn. Couldn't think of a word beginning with "a" that means "conference." [Editor's note: attendance?] To all you lucky people in Portland at OSCON, I wish I was there and am a seething mass of envy. Well, not that seething: I'm consoling myself by going to the WorldCon in Glasgow, instead.

Help Chip

geeksunite.org: tell all your friends; this cannot stand.

The Usual Footer

If you find these summaries useful or enjoyable, please consider contributing to the Perl Foundation to help support the development of Perl.

Or, you can check out my website, now running on a new engine. There are also vaguely pretty photos by me.

Visit the home of the Perl programming language: Perl.org

Sponsored by

Monthly Archives

Powered by Movable Type 5.13-en