hospitalized for approaching perfection

My god, June, June must be the most amazing month of the year. Things are green, and the awareness is palpable that summertime is here, in the street, at the bars, at the beach -- this is the time that is not the other time.

June is when strange and wonderful things happen. My sister, who lives in DC, called the other day to say she'd be here in Barcelona this weekend. Just on Sunday I was walking to the park and ran into an old friend I hadn't seen since 2000. June is the month of picnics: of picnics on the Seine, of picnics in the park, of picnics on the beach, of barbecues on terraces. June is for bare feet and open windows. June is for fireworks and music in the street.

hack

And yet, I hack, so much. I'm growing a little concerned, to be honest -- but now more than ever I feel like I'm doing my best work, and so I continue. It might be an illness.

In case you're new here, I've been hacking on Guile, an implementation of Scheme. Since my last dispatch, I landed a branch to Guile master that brings psyntax to the heart of Guile, as the default expander.

This was actually quite a feat, given the module hygiene work I wrote about earlier -- because how do you have an expander that understands modules and hygiene, before modules themselves have booted up? Anyway, it works now :)

For users, the practical implication of this is that syntax-rules and syntax-case are available, all the time. This is a lovely, lovely thing.

However, running the expander works against the most important performance hack of Guile 1.8: the memoizer. When you load a module, Guile 1.8 reads everything, but only does the minimum amount of work. For example, once it sees a procedure, it doesn't process the body of the procedure until the procedure is called. This reflects the reality that only a fraction of code is ever called, and was a big win for Guile 1.8.

But in Guile 1.9 / 2.0, we lose this advantage, as the expander does traverse all code. Of course, if your code is compiled already, it needs no expansion so loading is very very fast, but Guile has a lot of users and existing code out there, and I don't think they'd be particularly pleased if an upgraded touted to speed up their programs actually slowed them down.

So, for that reason, I hacked in some automatic compilation support, and turned it on by default. The upshot is that if Guile sees a file for which it can't find a corresponding compiled version, or the compiled version is out of date, it will compile it then and there -- and stash away the result, so it will be found the next time.

Of course, figuring out how to find the compiled files, and where to put the cache, but how to keep supporting shared installed architecture-specific compiled files, and how to cope with lack of permissions to write the compiled files, or errors in compilation -- you know, it's like Steve's legalizing marijuana. The devil's in the details. Hopefully I have things ironed out now, though. After all, if Python can do it...

Historically, expanding Guile Scheme with psyntax has had a couple more problems, though: the original variable names would be lost, due to the alpha renaming I discussed before; and, you lose source location information, so you don't know where backtraces come from. Through a stroke of luck and wine-induced hubris (thanks Ángel!), I did manage to plumb that information through, which is really pleasing.

(If you're still with me, I understand you are a programming languages enthusiast. Well to you I say: be wary of the verb "plumb". It suggests something shitty either about software of the process of making it. But I am willing to describe my interactions with psyntax as, indeed, shitty.)

(Continuing the parenthesis though -- are there not those that have a Freudian delight in shit? Whenever I hack psyntax I do feel better afterwards. It's a strange powerful relieved feeling.)

...

Perhaps the most relevant update from the last month in Guile is that we fixed a 2.0 release date, on the 15th of October; and we'll be releasing monthly until then, starting on the 19th of this month.

Also, Guile is finally joining the Unicode-speaking world, thanks to Ludovic Courtès and Mike Gran. We're using the little-known libunistring to do the heavy lifting; if there are packagers out in the audience, let this be my call to you to package this for your distros. It's by Bruno Haible, really well-done, and has been in Gnulib for a while now. It's time for it to go to distros.

Anyway, enough blathering for this Monday night. I was prompted into this by a fit of despair, looking again at the Waddell/Dybvig inlining algorithm. Perhaps after a more composed encounter with that paper, I'll have some novelties for the ether. Until then, happy hacking!

7 responses

  1. eoin says:

    It is indeed a wonderful, wonderful song.

  2. Grant Rettke says:

    How to handle automatic compiling and where to put the compiled files came up recently on the Ikarus discussion list:

    "Where should fasl files go?"

    and

    "Auto caching?"

    I would have posted the links but didn't want to get the post flagged:

    http://groups.google.com/group/ikarus-users

  3. Quim says:

    > If you're still with me, I understand you are a programming languages enthusiast.

    Wrong! I'm just a friend of yours willing to meet you again in few weeks, captured by the "hospitalized" word in your blog subject. Man, you are using cheap TV soap opera techniques to increase your audience!

  4. Abdulaziz Ghuloum says:

    So, I wrote this long response, clicked submit, and it told me "bad url" and ate my text. Bad blog!

  5. Abdulaziz Ghuloum says:

    Anyways, what I was saying is that the code for Waddell's inliner, or cp0, is available in Ikarus under ikarus/scheme/ikarus.compiler.source-optimizer.ss but the ikarus version does not implement some of the details like guaranteed inlining of singly-referenced vars. If you want to experiment with it, the easiest way is to do (new-cafe expand/optimize), type an expression, and see the result of expansion and optimization. The same trick works for Petite/Chez btw.

    Anyways, it looks like you're having good time bringing Guile on track.

    Aziz,,,

  6. wingo says:

    @eoin: Yes!

    @Grant: I do follow the ikarus list. Some of this was inspired by that discussion.

    My blog software doesn't flag anything, it just requires a valid subset of XHTML, and then gives rude error messages. Apologies for the latter bit :-/ The idea is that since git backs the whole thing, I can just revert comments if they're inappropriate, or revert the reversion if I made a mistake...

    @Quim: It wasn't intentionally dramatic ;) Just a reference to the lovely Random Rules. That album is *fantastic*.

    @Aziz: Thanks for the pointers, apologies for the comment filter, and thanks for the ongoing insight/inspiration on ikarus-users :)

  7. Dale Wiles says:

    I caught this on Planet Gnome.

    I'm glad to see that Guile is alive and well. I'm really glad to hear it now supports Unicode.

    What's the current level of support for Gnome? I tried to check it out at www.gnu.org/software/guile-gnome but got a "page not found". Ominous!

Comments are closed.