Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

autrijus (1505)

autrijus
  (email not shown publicly)
http://pugs.blogs.com/

Journal of autrijus (1505)

Monday October 10, 2005
07:39 PM

Day 220 (r7546): Gearing up for Euro OSCON.

With the release done, life resumed back to a less frantic pace but still with much fun. Yesterday's slashdotting was amusing and nice -- although chromatic regretted using the cute phrase "frivolous toy interpreter" to describe Pugs, overall it has resulted in more interest and reasonable discussions.

The only thing I did totally wrong was redirecting the then-unreachable autrijus.org to my Wikipedia Page before I slept; immediate vandalism ensued to change my photo into goatse, and it stayed up there for six hours. Ow! :-/

Today's #parrotsketch meeting went well. obra adopted a new trick of asking each participant what is blocking them, and it triggered a sudden flow of constructive discussion; I hope this format continues for the weeks to come.

I asked on the sketch for ideas of the Euro OSCON lightning talks -- because I'm procrastinating on preparing my slides, and having to prepare more slides sounds like a useful distraction -- and obra gave me an idea of presenting alien and advanced language concepts. To that end, I submitted the first lightning talk proposal, "Visual Basic Rocks!":

In the Open Source world, VB has long been held in disdain and contempt. However, ever since the VB team was infiltrated by lambda ninjas, it took a strange turn and introduces some mind-bendingly advanced concepts not found in free dynamic languages. You'll have to see it to believe it!

Inspired by her the Hunting of the Perl, I also asked Allison to do a poetry performance together, and she graciously agreed. After some brainstorming, we decided to adapt the Earendil song into "Larry was a mariner",:

In this lightning talk, Allison and Autrijus will perform an adapted version of Tolkien's Song of Earendil, the "title poem" of both Perl5 and Pugs, to celebrate Larry's long and fruitful voyage in the land of Perl.

On the code front, eric256 did a cleanup of the examples/ directory, correcting a few that lapsed due to minor syntax changes, and uncovered a bug: s:g/\s*// would hang indefinitely as our zero-width substitution was not advancing the cursor. I fixed it promptly.

iblech, in search for the remaining few features that the JavaScript backend does not yet support, implemented .assuming (which prompted fglock to add it to PIL-Run too), numeric bitwise operators. He also hacked in escape-code-free .perl support for byte strings, and .perl for regular expressions.

rafl worked tirelessly to get the packaing Just Right; with nomeata's help, Pugs 6.2.10 is uploaded to Debian now. Yay!

Stevan fixed the implementation of eigenclasses a bit, then sanity-checked with me the idea of a parallel eigenclass hierarchy created eagerly for each Class object, in a Smalltalkesque fashion. Fortunately, this eigenclass thing is quite orthogonal to the rest of metamodel, so it shouldn't hinger my move into container and metamodel runcore...

With leo's help, embedding with Parrot (post-0.3.0 trunk) is fully resumed; among other things, we were missing a Parrot_exit call, so stdout was not flushed. I factored out _GlobalFinalizer, so now all embedded Parrot objects and Perl5 objects will be finalized alongsid Pugs objects upon program termination.

That's it for today. See you tomorrow!

Sunday October 09, 2005
08:14 PM

Day 219 (r7520): Pugs 6.2.10 released!

I am delighted to announce Pugs 6.2.10, released during a slashdotting on geoffb's "Optimizing for Fun" column:

The release tarball will be available from CPAN shortly:

http://pugscode.org/dist/Perl6-Pugs-6.2.10.tar.gz
SIZE = 2394516
SHA1 = 3d8669fdccc3616c99cdde68659759b8b5782859

With two months of development, this release features more tightly integrated JavaScript and Perl5 code generator backends, a library interface to the Pugs system via support for the Haskell Cabal frameworks, as well as many new tests.

After the release, the push toward 6.28.0 will begin in earnest, with the newly specified container model and object model integrated back to the main runtime, fleshing out support for the remaining OO features.

Again, thanks to all the lambdacamels for building this new ship with me. :)

Enjoy!
/Autrijus/

Changes for 6.2.10 (r7520) - Oct 10, 2005

Feature Changes

Shared components

  • Support for the Haskell Cabal framework, exposing Pugs as a library to other Haskell users, paving the way for use in IDEs, as well as future Inline::Pugs and Inline::GHC modules
  • Adopted the code convention of expanding literal tab chars to spaces
  • JavaScript backend can be invoked with pugs -B JS
  • Perl 5 backend can be invoked with pugs -B Perl5
  • Pugs will now compile version ranges in 'use/require' statements
  • Significant backend enhancements; see below
  • $?PUGS_BACKEND can be used to tell which runtime is in use
  • exec emulated (partially) on Win32

JavaScript backend

  • Passes 91% of the main test suite (including TODO failures)
  • Integrated with MetaModel 1.0
  • Faster code generation, taking advantage of -CPerl5 output.
  • Switched to continuation passing style (CPS) to properly support return(), &?CALLER_CONTINUATION, coroutines, and sleep()
  • Improved support for binding and autodereferentiation
  • Initial support for multi subs
  • Initial support for symbolic dereferentiation
  • List construction no longer creates new containers
  • Miscellaneous performance improvements
  • Named-only arguments (+$x and ++$x) can't be passed positionally anymore
  • Parts of the Prelude can be written in Perl 5 now to improve performance
  • Perl 5-like regular expressions mostly working
  • Proper UTF-8 handling
  • Support for "monkey-but" ($foo but {...})
  • Support for $CALLER:: and $OUTER::
  • Support for lazy {...} blocks for delayed evaluation
  • Support for temp and let declarations
  • Support for array and hash autovivification
  • Support for array and hash slices
  • Support for evaluating expressions in the PIL2JS shell (:e <exp>)
  • Support for junctions
  • Support for loading JSAN modules by using use jsan:Module.Name
  • Support for lvalue subroutines (foo() = ...)
  • Support for slurpy hashes in subroutine signatures
  • Support for the Proxy class (not yet user-visible)
  • Support for the eqv operator
  • Using for with only one element to loop over works now
  • int() works correctly on special values like Inf or NaN now
  • substr() returns a r/w proxy: substr($str, $pos, $len) = $replacement)

Perl 5 backend

  • Passes 33% of the main test suite (including TODO failures)
  • Integrated with the Perl 5 edition of MetaModel 2.0
  • Compiles and runs Perl 6 version of Test.pm
  • Infinite lazy lists, Pairs, References, and intrinsic classes
  • Multi Sub, Class, Match, exceptions, types and subtypes
  • Scalar, Hash and Array containers, with tieing, binding and read-onlyness
  • Support for an extensive list of operators
  • Supports eval() with Perl 5 and Perl 6 code
  • %ENV is shared with Perl 5; @INC is separate from @Perl5::INC

Bug Fixes

Shared components

  • Fixed foo {1}.blah being misparsed as foo({1}).blah
  • Fixed a hashref infinite loop
  • Fixed infinite loop on sub { 1 }.pairs
  • Multiple sub foo no longer silently means multi foo

JavaScript backend

  • Fixed evaluation order of assignments and bindings
  • Fixed .values and .kv to return aliases

Bundled Modules

New Perl 6 modules

  • Perl6-Container-Array, Perl6-Value-List: prototype modules for implementing Lazy lists in Perl 6.
  • Log-Selective
  • Cipher - Cipher API suite for cryptographic ciphers
  • FA-DFA

Updated modules

  • Locale-KeyedText: Synchronized with p5 version 1.6.2
  • Test-Builder: new APIs, including test_pass() and test_fail()

Experimental modules (in misc/, not installed)

  • Blondie, prototype compiler for native code generation and type-inferencing with Attribute Grammers
  • XML::SAX
  • Getopt::Long
  • Rosetta-Incubator, a complete set of Rosetta[|::] and SQL::Routine[|::] modules, restarted development at 2005.09.29

Test, Examples and Documentations

  • Many new tests and test refactoring, we now have 10300+ tests
  • Documentation for draft GC API at docs/notes/GC.pod
  • Data file for curcular prelude exploratory diagram at docs/notes/compilation_of_circular_prelude.graffle, some examples at docs/notes/circular_prelude_stuff.pl
  • Collaborative journal at /docs/journal
  • Autrijus's CUFP talk at /mirror/pugs/docs/talks/cufp2005.txt
  • Theory Model proposal at docs/notes/theory.pod
Saturday October 08, 2005
07:18 PM

Day 218 (r7453): Night before 6.2.10.

...and I foolishly thought Cabalization was the only thing left for the release. Silly me. :-)

So, the main test suite is passing 100% now, and only one small OO bug remains in the extension tests. That's the good news.

The not-so-good news is that Cabalization triggered uncovered a bunch of issues previously swept over the carpet: where to install pugs-specific files, where to install modules that are useful for any perl6 implementation, and how the directory structure interact with Debian, FreeBSD, Win32, and various other hierarchy systems.

In addition to this, there were various issues around GHC 6.4/6.4.1, Cabal 1.0/1.1.4, embedding Perl5 (shared/static), embedding Parrot (0.3.0/trunk). Thanks to patient and helpful feedback from #perl6, I think we figured out solutions to all of them -- hmm, famous last words. ;-)

All in all, I'd like to thank rafl, iblech, gaal, scook0, geoffb, vkon, xinming -- among many others I'm sure I missed -- for ironing out this complex interactions between build systems so readily and thoroughly, and I hope tomorrow's release will prove our effort worthwhile. See you!

Thursday October 06, 2005
09:59 PM

Day 216 (r7372): Pugs, Cabalized!

No, this Cabal is not @Larry, but rather the Haskell Cabal, the equivalent of Module::Build. After lots of overtime hacking today, Pugs is finally built using cabal, thus exposing Pugs as a library to other Haskell users:

import Pugs
main = doRun "-" [] "say 'Hello, World!'"

Aside from the obvious application to hIDE and other script-haskell-with-perl6 uses, this also makes Inline::Pugs and Inline::GHC much nearer in sight, which is a Good News for people who'd like to mix perl6 code with perl5. Of course, it can't replace the seamlessness of the Pugs/Perl5 runtime, but TIMTOWTDI.

#perl6 is unusually lively today under the -Opun (optimize for pun) banner; again, I blame Why. And yes, I'm quite aware that we are the only bunch of people who use EigenClass seriously, but it fits in right alongside names such as Psyche, Pneuma and Chaos. Parodies do find a way into real life...

Prompted by his righteousness as a debian packager, rafl undertook the massive job of reorganizing the modules/ and perl5/ directory into the installable (and eventually CPANable) perl5/, and the for-your-information-only misc/. Hurray!

gaal finished triaging the failing tests, eliminating the t/ ones, so we only have some 100 of ext/ ones to worry about tomorrow. There are a bunch of other developments today, but I can't keep up anymore. See you after a much deserved sleep. :)

Wednesday October 05, 2005
06:07 PM

Day 215 (r7327): -Ofun: The most important optimization.

geoffb fulfilled his promise and delivered a nice write-up of yesterday's #perl6 discussion. The immediate reaction:

<autrijus> geoffb: I feel... a bit embarrased I guess, but very grateful for the writeup. it's excellent.
<geoffb> thanks
<autrijus> geoffb++
<geoffb> I had a choice to make you anonymous or not, I decided that people just plain like celebrities. :-)
<leo__> geoffb++
<geoffb> thanks for the kind words
<autrijus> geoffb: hence, the embarrasment

It is an excellent summary. However, I'd like to stress that none of those are designed upfront; indeed, I didn't set out to do anything more than modelling junctions. As geoffb said, everything else were spotaneously derived from optimizing for fun.

In other weblog news, why the lucky stiff immediately noticed that we did, in fact, steal the eigenclasses -- which is I suspect that he was aiming for all along, with all those hypnotising Least Surprised comic strips. So: well done!

With gallant help from gaal, we brought the failing subtests down to less than 200 -- one more day's work and it'd be releasable. Several weird bugs got fixed today, including the one that rendered say {1}.() into (say{1}).(). Oops.

Also, the Perl5 and JS backend generators are now installed with Pugs, so pugs -BPerl5 and pugs -BJS should run in the PxPerl binaries for 6.2.10, in addition to the PIR backend. I'm glad to see that the two stand-alone backends are in a good shape to become the highlight of this release.

Gaal also made all I/O errors catchable with try{}, thanks to a newguardIO lifter that promotes IO errors into fail in the Eval monad.

Tomorrow will be mostly about tidying up for the release. geoffb updated the STATUS file extensively, so that leaves some changelogging and cabalization.

Oh, and an unfortunate news: TSa bowed out from the p6l mailing list, ironically at the same time as I refined the 6.2831 milestone into Type system and linking. I'm grateful to him for keeping up discussions about types, as well as referring me to various useful papers. Hopefully we'd indeed make Perl 6 the artige Sprache -- language of kindness -- as he wishes.

See you tomorrow! :)

Tuesday October 04, 2005
06:01 PM

Day 249 (r7292): Toward 6.2.10.

I'm finally setting the land in order, with aid from a richly alive #perl6. Together we fixed and TODO'ed some 400+ failed subtests today, with about the same number to go tomorrow, before we can release 6.2.10 in good conscience.

Happily, leo has become a #perl6 resident; with his help, we regained compatibility with Parrot 0.3.0's new calling conventions, and rules support via PGE again works. The new calling conventions are much saner; chip/leo have done a wonderful job. They are working on named parameters, lexical pads and variable-sized register frames for 0.3.1, which could be the first Parrot that Pugs can seriously target to.

Talked with Stevan about MM2, and we both agreed that Ruby-style singleton classes -- I mean eigenclasses -- is a saner way than this arbitrary distinction of class methods and instance methods. The user-visible API (aka metaobject protocol) would remain the same, but the internal dispatcher would be much easier to reason about.

After fixing the aforementioned arbitrary dispatch in the default runcore, brentdax's Cipher suite passed all tests. It's a nice demonstration of multi-paradigmic module API; it supports functional, OO and procedural modes of operation.

Following yesterday's Parrot Sketch (which finally appeared on Planet Six), nothingmuch volunteered to parse the rules tests into specification-based Test::Base tests, so we can move them all into the Parrot tree where it belongs.

So, things are looking good for 6.2.10; we still need to solve installation for perl5/, and I'd like to integrate Pugs.cabal for libpugs.o support as well.

After 6.2.10, the push for 6.28.0 will be done roughly by taking the PIL compilation backend, write a new container/metamodel runcore in Haskell to make sure it works correctly, improve the intermediate language until it hits what we needs for PIL2, and adjust js/p5/parrot backend accordingly.

Two months is an extremely long period between two releases; thanks for all lambdacamels for getting it into a fine shape, largely in my absence. It looks like -Ofun is a worthwhile optimization after all: I'm happy to rejoin the fun, and even happier to see new committers around. geoffb promised to capture some related discussions in his weblog tomorrow; I'm looking forward to see it. Ciao!

Saturday October 01, 2005
04:19 PM

Day 246: Travelling.

Finally got some semblance of internet access now, and I'm ready to crash, so more detailed journal and commits will need to wait till tomorrow.

On the road I studied EHC and its way of using attribute grammars to illustrate separate concerns of compiler aspects is commendable. Haskell's type classes can implement synthethized (upward) attributes easily, but inherited (downward) attributes require a reverse-case, and AGs seem to be a better way to write them.

I also started coding Pugs.Class.Chaos, Pugs.Class.Pneuma, and the rest of the metamodel bootstrap. Doing this has made the migration plan somewhat clearer -- instead of migrating the internal language, the compiler and the runcore in a swift run, I'll instead realize the object runcore in a more modular manner, and replace upstream components as I go. More details tomorrow...

Friday September 30, 2005
05:21 PM

Day 245: Haskell Workshop.

Today's workshop has been a blast. David Roundy's darcs talk covered many challenges and advantages in using Haskell to develop a real-world application; he even mentioned SVK once, in a positive light. Among other cool tricks, he employed interleave IO to separate program logic with I/O parts. I have used that trick in OpenAFP, but I'm beginning to see that has wider applications as a Pugs/Perl6 idiom -- AOP with Lazy Lists, if you will.

The Cabal/Hackage system (the equivalent of Module::Build/CPAN) generated much interest. Discussions centered around how to incite spotaneous mutual goodwill using social software frameworks, which is imho the key part of the CPAN cultural mechanism.

I'm glad to hear that the huge GHC distribution will be broken apart into various packages, to promote the sense of community library ownership. In the future, the GHC core will be minimal, just enough to run Cabal to install packages -- Perl5 porters have bounced this idea for quite some time now, and it's nice to see it happen here too. In addition, the Haskell people are also reducing the committer-bit deadlock, by adopting decentralized darcs repositories as the norm, so a change of maintainership is simply a URL redirection apart.

Another focal point is hIDE, a Haskell development environment coded in Haskell, using the GHC bindings and build structures developed in the Visual Haskell effort. The choice of Yi as the editor component is particularly interesting -- it can dynamically load and rebind plugins, including the editor core itself, preserving the editor state (undo history/workspaces) without requiring a restart like Ecplise does. I suggested to dons that we should integrate the bootloader with GHC/Cabal, so all Haskell applications compiled this way can be code-swapped on the fly, even by eval'ing code from the user. I like dynamic languages with static typing...

I helped the library effort by polishing dons's Data.FastPackedString module, so it can subsume the old Data.PackedString implementation. The new string module is very fast and supports FFI, gzip and mmap natively. It is already used in the new PIL runtime; once it's merged into GHC core, it should give string manipulation-heavy programs a nice speed boost.

Hacking of GHC core continued. Pairing with wolfgang, the new ICFP 2005 contest champion, is very exciting and fruitful. We reasoned out how to support record updators for existentially-quantified GADT types, which is starting to dangerously resemble ML-style modules.

Also, from discussion with oleg and ccshan, I learned that GHC is actually well-equipped to natively support delimited continuations in the runtime. If implemented, Pugs's Haskell runtime can do away with the space-intensive ContT monad transformer thunks, and get a massive speed boost without changing a line of code. simonmar showed me the GHC runtime scheduler, and indeed there seem to be native support in the form of thunk-capturing asynchronous exceptions (which will incidentally give native support for the Perl6 $!.resume). Using a similar mechanism, we can also get a stack trace -- easily the #1 requested debug feature -- from fatal errors, at least when compiled for profiling.

Whew. That's a lot of hacking. Tomorrow I'll go back coding in MM2 and full Cabal support, and investigate full continuations on top of Perl5 VM. Stay tuned!

Thursday September 29, 2005
04:39 PM

Day 244: Hacking GHC.

Continuing yesterday's work, today I got seriously addicted in GHC core hackery, skipping the entire Curry workshop. It was a real pleasure pairing with spj on this. He reminded me of lwall -- both have an obsession on providing useful feedback to programmer, strong intuition on how language features intersect, and above all a deep enthusiasm to their respective languages.

Thanks to spj's continuous guidance, I hacked in support for existential record types on both vanilla and GADT types, which allows us to write:

data Counter public = forall this. New
    { self   :: this
    , inc    :: this -> this
    , output :: this -> IO ()
    , tag    :: public
    }

The tag function is well-typed as Counter public -> public; the other three fields hides the real implementation from the Counter data type, so one can have a counter using Int, another using String, and have both be of the same type.

This representation is quite close to how encapsulation works in OO langauges, and the feedback from #haskell has been very positive. Additionally, the soundness of the GADT/Labels treatment passed scrunity by Oleg today, which made me feel much safer.

Of course, any attempt to use the three private fields as normal functions raises a compile-time error that advises the use of pattern-matching syntax instead. Also, in the GADT form, the forall this may be omitted to improve readability.

While I was madly hacking away, brendan passed by, and graciously accepted a Pugs T-Shirt from me. We talked about many things -- I'm very excited to hear that they are considering to adopt Rhino's continuation engine for SpiderMonkey (which will make Perl6-on-JavaScript insanely faster), and that the XUL scripting is proceeding well. They would like to use user's system python/perl/ruby/etc if possible, but that complicates the versioning problem.

Inevitably, the topic of shared runtime came up, and it seems that Mono's RAND patent position is still not yet very satisfatory. Parrot has matured a bit since two years ago when brendan checked it out, so I filled him on some recent development. With 0.3.0 out in a couple days, we can finally start targetting Parrot again -- hopefully the long wait will be proven worthwhile.

Oh, do check out geoffb's writeup of his musings on #perl6; it's a nice survey of some of the good ideas from other language that are finding their way into Perl6.

After yesterday's discovery of ILX codegen, spj pointed out that there is a more robust Java codegen on the same directory. Targetting JVM suddenly looks more attractive too...

All in all, I think my time on hacking GHC core is well-spent; I learned a lot of Haskell idioms that should make Pugs code cleaner (such as the case x of DataCon {} -> ... syntax that works even on non-record types), and about complexity management of a large real-world language implementation -- i.e., what makes it to evolve extremely fast, despite a relatively small core team and contributor base, and an utterly broken issue-tracking system. RT-powered bugs.haskell.org seems like a good idea...

Tomorrow is the Haskell workshop, the final day and highlight of this conference. See you!

Wednesday September 28, 2005
04:28 PM

Day 233: Reports from ICFP!

The main ICFP conference session concluded today, so I'm finally getting a tiny slice of time to write down what I've been doing.

I enjoyed handing out Perl6/Timeline T-shirts to various lambdafolks, including bpierce (author of TaPL), spj (author of GHC), as well as several cool hackers from #haskell. At any time in the conference hall, there was always someone with a Pugs shirt in sight, leading to many interesting discussions and opportunities to join forces.

I spent much time hacking with the GHC core team (spj and simonmar, also known as "Simon and Simon"), to get my current #1 feature request -- GADT with record types -- into GHC. Among Haskell people, GADTs are all the rage this year; see luqui's notes for a short introduction from Perl6's perspective.

During the YAPC::NA 2005 Toronto hackathon, I presented the then-brand-new PIL1 data structure to @Larry, using GHC's then-brand-new GADT syntax:

data PIL a where
    PCode       :: SubType -> [TParam] -> PIL [Stmt] -> PIL Expression
    PBind       :: [PIL LValue] -> PIL Expression -> PIL LValue
    PAssign     :: [PIL LValue] -> PIL Expression -> PIL LValue
    -- ...etc...

luqui looked at it and asked quite innocently: "Why are the arguments not labelled, such as 'lhs' for 'PAssign'?" -- To which lwall said, half-jokingly: "Because autrijus is a lazy bastard."

However, the real reason was because GHC's extended Haskell syntax only allowed positional argument types for GADT. To name them with the record syntax, we'd need to go back to the vanilla data types, and forgo the ability to encode type information using the constructor's return type (as demonstrated in PIL Expression and PIL LValue above).

A month later, I diligently re-encoded the structure using vanilla record types, so we can export them into hash-based Perl (and JSON) data structures, instead of array-based ones. This significantly improved the readability of iblech's PIL2JS code, but the Haskell data declaration became 3 times longer, because each GADT variant needs to be re-encoded into vanilla data types.

Ever since then, I was hoping that GHC may one day remedy this by allowing GADTs and record syntax to play together. When I met spj in ICFP, he was gladly surprised that I'm eager to hack GHC to make it happen. After bouncing several design ideas, we settled on this syntax:

data PIL a where
    PCode   { typ :: SubType, params :: [TParam], body :: PIL [Stmt] }
        :: PIL Expression
    PBind   { lhs :: [PIL LValue], rhs :: PIL Expression }
        :: PIL LValue
    PAssign { lhs :: [PIL LValue], rhs :: PIL Expression }
        :: PIL LValue
    -- ...etc...

The neat thing is that PBind and PAssign can share the lhs and rhs labels, as long as their return value PIL LValue stays the same.

During the reception, spj was kind enough to guide me through the GHC core to unify the two data type definitions together back. The next day, simonmar walked me through the Happy parser to get the new syntax recognized, and today spj showed me how the GHC typechecker works. All there's left is installing the labels as record selectors, and the upcoming GHC 6.6 will have a nice feature to fit Pugs's needs. Hacking GHC is evidently not as difficult as I feared! :-)

Talking about GADTs, I was also involved with the crazy project of encoding the Darcs patch algebra into the GADT type system, letting the compiler catch entire classes of common logic errors in darcs, bringing us dagerously close to the ideal of proof-carrying code.

Two days ago, when droundy told me this idea, I was very excited, started prototyping it, then promptly ran into errors on existential types. Heffalump took my laptop and shuffled it with Igloo, arriving at something that seemed to compile, which evolved into an embedded DSL for patches. After today's conference sessions, a dozen darcs hackers gathered together, learned about the recent developments of the patch theory, then worked on the GADT encoding. The hacking session was quite successful -- we didn't run into any showstoppers, much to everybody's surprise -- and I visiolized the whiteboard into this diagram.

On the Pugs backend front, I learned from simonmar the existence of the ILX emitter library, hiding in a forgotten corner of GHC source tree. This enables us to emit pre-CLR-2.0 MSIL code that could run on Mono, under a 3-clause BSD license. Targetting CLR suddenly looks more attractive...

I also learned how to generate native machine code straight from C--, using the GHC API distributed as part of Lemmih's ghc-api Cabal package.

Speaking of Cabal, I learned from SyntaxNinja about the design of the Cabal/Hackage system, which is the Module::Build/CPAN equivalent for Haskell. We shared our experiences, and he helped me setting up the basic Cabal build rules for Pugs. With Cabal support, Pugs's Makefile.PL would only need to care about the Perl parts in the source tree, and we can finally get a libPugs to link with pugscc and other programs -- Inline::GHC is definitely on the radar, and the idea of using Perl6 to script the Haskell IDE (hIDE) is also gaining some traction.

Compiling with continuations, another pet interest of mine, also got a boost from ICFP. The Generalized Stack Inspection talk outlined how to use vanilla try/catch mechanism to implement full continuations, which is much more efficient than the regular trampolining approach as used in Pugs's JavaScript backend, since only people who actually use full continuations need to pay the cost for catch. Their technique operates on the ANF form, which seems to be a good low-level intermediate form for Pugs.

Interestingly, the paper went as far as saying that Parrot might have made a suboptimal choice in paying the full cost of going full-CPS, since we could emulate full continuations using exception handling efficiently. They gave concrete implementations in CLR and JVM -- we'll see if this result can carry over to Perl5 and JavaScript runtimes.

The invited talk of the first day tackled impredicative type inferencing, a long-standing problem in inferring types for a rich system such as Perl6. I had much trouble grokking the Wobbly Type idea of spj's, so I was much delighted to see that fpottier gave a very intuitive treatment of splitting the user-annotation-driven phase and the complete inferencing phase apart.

Oh, the ICFP contest. Haskell won again, which came at no surprise, but the Dylan Hacker team made another strong showing. From the brief investigation, I think Dylan is even closer to the "Perl 6 without advertisement" mark than Ruby, largely due to its incremental soft typing system, where one can start rapid prototyping with full dynamism, then generate more efficient and robust C code by adding type annotations.

Tomorrow is the Curry workshop, then the Haskell workshop on the day after. After that I'll get two weeks of Pugs hacking time. I can barely wait to apply those new techniques, tools and thoughts into Pugs!