Slash Boxes
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)

  (email not shown publicly)

Journal of autrijus (1505)

Thursday September 29, 2005
04:39 PM

Day 244: Hacking GHC.

[ #26942 ]
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 seems like a good idea...

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

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
More | Login | Reply
Loading... please wait.