The Perl 6 Summary for the week ending 2005-08-02 In case you were wondering, Darwin ports didn't work it's 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 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 is happening 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 seems to be directed towards being able to do useful things and optimizations with Type information) in this thread. <http://xrl.us/gzbx> 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. <http://xrl.us/gzby> 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 behaviour (lexical scopes really are lexical) makes a compiler writer's head hurt. Autrijus outlined a plan for making it work. <http://xrl.us/gzbz> 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 it could be applied any time soon, because he had another patch that depended on it. It turned out that the patch hadn't been applied because it broke a test or two, and Will Coleda, Andy Dougherty, Patrick and Leo set about helping to track it down. It looks like the issues have been found, and work continues to fix them. <http://xrl.us/gzb2> '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, all is explained in this thread. <http://xrl.us/gzb3> PMC syntax Klaas-Jan Stol asked if there's any documentation about 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. <http://xrl.us/gzb4> 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. <http://xrl.us/gzb5> 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! <http://xrl.us/gzb6> 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. <http://xrl.us/gzb7> 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 no key is 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... <http://xrl.us/gzb8> 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. <http://xrl.us/gzb9> Super! Leo announced that he'd added a new Super PMC which will make it easier to call superclass methods. <http://xrl.us/gzca> Lua Project Klaas-Jan unveiled his project to get the Lua compiler targetting Parrot. It's apparently 'far from complete', but hey, it's good to welcome yet another language to the parrot cage. <http://xrl.us/gzcb> <http://xrl.us/gzcc> 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. <http://www.smashing.org/mod_parrot> <http://xrl.us/gzcd> 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 realised.) I don't think there's been a final decision as yet, but we're definitely moving forward. <http://xrl.us/gzce> Slurpy parameters and auto flattening Ingo Blechschmidt asked for some clarification of the behaviour 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. <http://xrl.us/gzcf> Exposing the Garbage Collector Bah! I propose a simple, slow, yet powerful feature which can be used 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. <http://xrl.us/gzcg> 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". <http://xrl.us/gzch> Elimination of Item|Pair and Any|Junction The discussion of appropriate default prototypes 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. <http://xrl.us/gzci> 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 was 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. <http://xrl.us/gzcj> 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. <http://xrl.us/gzck> 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. <http://xrl.us/gzcm> 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. <http://xrl.us/gzcn> Inferring (Foo of Int).does(Foo of Any) Autrijus again, this time thinking about the kind of type inferences that can be done with Perl aggregate types. Once I'd got 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. <http://xrl.us/gzco> Garbage Collector API Various additions to the proposed Garbage Collector API were proposed. <http://xrl.us/gzcp> "$value.confess()" Brent Royal-Gordon had a cunning idea for debugging of having Perl 6 capture the call stack at their point of creation and stashing that in a property called confess, which could be examined 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. <http://xrl.us/gzcq> Slurpy "is rw" arrays Having got clarification of the behaviour of normal slurpy arrays, Ingo Blechschmidt asked for clarification of the behaviour of Slurp "is rw" arrays. Adriano Ferreira and Thomas Sandlaß seemed to talk sense in reply. <http://xrl.us/gzcr> 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 was supposed to 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. <http://xrl.us/gzcs> Laziness and IO In a currently Warnocked post, David Formosa outlined a potential problem with lazy IO. <http://xrl.us/gzct> "sub foo ($x) returns ref($x)" In his continuing discussion of the Perl 6 type system and the inferences that can be drawn 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. <http://xrl.us/gzcu> &say's return value Gaal Yahas thought that &print, &say should "fail" on errors and return the printed string on success (but true). Larry thought not. So it looks like they'll end up returning a Boolean or throwing an exception. <http://xrl.us/gzcv> "$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 behaviour of references. Larry clarified. <http://xrl.us/gzcw> 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. <http://xrl.us/gzcx> 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." <http://xrl.us/gzcy> Module init hooks and pragmas Gaal Yahas wondered what function in a module gets called when you 'use' or 'no' it. Warnock applies. <http://xrl.us/gzcz> Eliminating "&{}" and "*{}" Autrijus wondered if we really need the "&" sigil. Warnock applies. <http://xrl.us/gzc2> 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 it got Warnocked but the References: header in Andrew Shitov's posed discussed below was a little broken... <http://xrl.us/gzc3> "zip" with () Andrew Shitov got caught out by some strange behaviour of "zip". Ingo explained what the problem was. 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. <http://xrl.us/gzc4> 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 5ish, behaviour back. Thomas Sandlaß wondered if simply explicitly declaring the given block's argument as "rw" wouldn't do the job. No word from @Larry yet. <http://xrl.us/gzc5> Acknowledgements, adverts, apologies, alliteration and Conference envy Damn... couldn't think of a word beginning with 'a' that means 'conference'. 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 <http://geeksunite.org/>, tell all your friends, this cannot stand. The usual Coda If you find these summaries useful or enjoyable, please consider contributing to the Perl Foundation to help support the development of Perl. <http://donate.perl-foundation.org/> -- The Perl Foundation <http://dev.perl.org/perl6/> -- Perl 6 Development site Check out my website, now running on a different blog engine and adorned with even more new articles. And adverts and stuff. Buy books, click on Google links, help me cover my bandwidth costs. You know you want to. <http://www.bofh.org.uk/> Vaguely pretty photos by me can be found at: <http://xrl.us/gzc6>