wingolog

i, lucifer

10 December 2008 10:56 PM (lucifer)

"Long ago you broke off your yoke
and tore off your bonds;
you said, 'I will not serve you!'
Indeed, on every high hill
and under every spreading tree
you lay down as a prostitute."

Jeremiah 2:20, NIV

While browsing through a used bookstore on my recent trip to the States, a yellowed pamphlet fell out of one of the books. I bought the book for five bucks, careful not to reveal the existence of the insert, whose contents I reproduce here.

Dear diary,

Finally, my job search has ended at last! I got this sweet new job over at the department of administration. I met my new co-workers last week, Mike and Gabriel ("Gabe to my friends", he says). They're new too, so it seems we're all going to be learning together.

The boss says we have to be presentable at all times, so I guess that means goodbye to my scruffy goatee. Oh well, it's a worthwhile sacrifice -- it really seems like this is the break I've been waiting for all these years and years.

Anyway, things are really busy now -- I'll write soon!

Sincerely,

Luke

* * *

Dear diary,

The job's still going pretty good, though the boss is a pretty hard taskmaster. Every day I'm out at the branch offices telling other workers how to do their job. I feel bad for them, they're totally overworked. Well, I am too. We hardly get any time with the harp!

Anyway, seems I got a bit agitated there. I guess it's to be expected, given that I have to keep it all in during the day. Still, the benefits are pretty sweet, and I have to admit I look pretty great in my work uniform.

Otherwise, all seems OK. I know I've been pretty bad at writing recently, but I'll try to write back soon.

Yours,

Luke

* * *

Dear diary,

I am starting to get pretty fed up with those brown-nosers Mike and Gabriel (no, I'm not his friend). All the time it's like "What can I do for you, Lord?" "Lord, your might is without limit!" "Lord, Lord, Lord, blah, blah, blah." Grrr! Don't those guys have any self-respect?

Plus, the workers that they manage have been raising hell. The strike last week at the border nearly stopped immigration completely. And the crackdown... wow. It was pretty brutal -- "feathers were flying", as they say.

Well, just keeping my head low for the time being. I'll rap at ya later.

Peace,

Luke

* * *

Dear diary,

It seems like my discontent has been making the rounds. Today I got fired for "insubordination".

I guess it all came to a head when I gave that speech at the gate rally, saying I was tired of being Seraph's Deputy. The cheers and flapping from the crowd felt good then, but now I'm out of work, and that also means I'm out of the company housing.

The "Lord" claims to know where I'll go now, but I don't know that myself. I asked Mike if I could stay at his place; we'll see what he says.

Further bulletins as events warrant,

Luke

* * *

Dear diary,

I've settled on an unused piece of land, just down the valley from where I used to live. I can see the hills and clouds from my shack, and I'll have to admit that life was pretty privileged when I lived up there. But I'm finding things about my new environment that are quite nice as well -- the lush greenery, the salamanders in the river, and the simple pleasures of honest work, tossing hay to my goats with a pitchfork.

I don't see much of my old co-workers anymore, and to be honest I don't miss them much. I do have to work sometimes for farms around the valley just for part of their harvests, but I'm pretty happy working for myself.

Anyway, that's that. Time to go tend the fire, it gets cold here at night.

Laters,

Luke

Though I think the diary continues, my pamphlet ends here. I'll let
y'all know if I find more pieces of it.

another (turkey) bites the dust

25 November 2008 10:03 PM (turkey | thanksgiving | aikido | miyamoto)

recent past

Miyamoto sensei came to town to last weekend to teach an aikido seminar, as he has for the past four years or so. I found a nice article on him chez Takezo, which captures much of the spirit of such events, in text and video.

Between sessions on Saturday, I zipped by the Boquería to pick up the 5.6-kilo turkey. Hoo boy. We cooked and ate it on Sunday, which was a most delightful dress rehearsal. I made a stuffing with leeks, almonds, and figs -- and eggplant instead of old bread. It turned out great, much better than I thought it would. Who knew?

Though, what the hell is up with my friends? I told people that food would be ready between 3 and 4, and the first people (out of 15) show up at 4:30. Being in Spain only explains so much.

near future

Tomorrow I catch a plane to the states for the real deal -- my first Thanksgiving in the states since 2001. Yay for winter cooking, in which every pot contributes to the condensation on the inside of the windows.

(Not that I'm going to turn this thing into a confession booth, but I do admit a bit of ill feeling towards eating animals. But turkey smells so magical...)

things I did

24 November 2008 0:36 AM (namibia)

Tonight I would like to write about something of which I am deeply shameful. Please bear with me as I describe my experiences.

From the beginning of 2003 to the end of 2004 I had the privilege of teaching 8th and 9th grade kids in Namibia, a southern African country grappling with the aftermath of apartheid. Unfortunately for my students, I failed.

As a worker within the educational system, I just did my job, namely: convey the curriculum conferred upon me to convey. I damaged kids in the process. Let me count the ways, from nonmonotonically least to worst:

  • I made kids take tests.

    Typically these would be tests coming from the district, containing problems from previous examinations.

    These examinations favored students that understand the intentions of those "setting" the test over those students that had a love for questions and not for answers.

  • I acquiesced with the idea of giving kids multiple-choice tests, and with the idea of giving them tests in general.

    These tests always check answers rather than feeling. A student who has a feeling for reality must be able to formalize and reduce her ideas; a holist whose ideas are nuanced is necessarily required to reduce her ideas to symbology.

  • I forced kids away from their loves by engaging them in an alienated environment.

    The pressing question was not, "What do you think is the best way forward for your country with regards to energy?". Rather it was, "Compute the energy difference between position A and position B." The important questions have already been asked; the job of the successful technologist is merely to fill in the details.

  • I forced kids to ask for permision.

    • They asked for permission to go to the bathroom.

      A request to go to the bathroom (in reality, a row of latrines) was understood as a request either to suit bodily needs (plausible) or to escape from supervision. On the probability of the latter, I often refused requests, in order preserve my dominance.

    • Kids had to ask permission to engage in anything that left my authoritative purveyal.

      I always refused these requests to go home (to tend the goats that wanted to munch their neighbors' fields), to study in the library (an assured invitation to lasciviousness), etc. These were "obvious attempts to take advantage of our generosity".

      Note that here, "our" is not racial: it was classist. The prerogative was with the controllng class, in this case the teachers.

  • I humilliated kids via alienation.

    Those kids that really loved their subjects were forced to endure grueling tests to prove that they were worthy, whereas kids that just viewed subjects as hurdles were comfortably given exams on subjects not central to their fundamental ideology.

    To put it another way: those that did not love, were passed according to their dedication; those that did love their subjects were passed according to their ability to sublimate their love into obedience to the assigned canon.

  • I humiliated kids by domination.

    This point is very difficult for me to describe.

    For my Western readers, imagine this: you are out in the middle of what you perceive to be "nowhere". You are far from Bachelors' degrees, far from Madison Avenue, and you have been asked to take care of a group of 25 kids.

    At the beginning they are curious; also they are afraid. What's up with this white guy (in my case) teaching my class?

    In my case, well, I stuck to the subject as prescribed both by the curriculum and by the final examinations for my grade. After all, I wasn't going to leave my kids unprepared for my grade's exams.

    But all was not right. I went too slow for many. Also, some kids didn't quite get the things that I taught; I was going too fast. There were many valid reasons for this not-getting, not least the fact that South African Apartheid had formally ended only in 1990.

    Aside from that, though, there was a range of abilities in my classes. Should I have taught to the most advanced? To the most needy? Who were the most needy?

    Personally, I decided just to do my job as a teacher. I neglected Severus Hilma and Namwiha Sakaria (both beautiful, intelligent people) to teach to the rest. I don't really know why I did this -- some sense of the "broader good".

maintaining discipline

I think that I was wrong.

I should have taught only those who wanted to learn what I had to teach.

Those that I taught were already immensely intelligent -- many of them had been caring for their families and providing their own food for many years before they entered my classroom.

These peoples' knowledge was cheapened and degraded by being put through the industrial wringer of monetary effect. Schools produce the employable; these men and mostly women that had sustained their families with their sweat are worth *nothing* to the institutions seeking to pay back IMF-refinanced loans.

So they didn't need me and my coercion. All they needed was either a space in wish to consolidate their gains, or a helper along the path to academic credentials.

As I say, I failed in both. I neglected the first in an atmosphere of utmost discipline, and I neglected the last in a pedantic effort to make sure that all were at the same place in the great Textbook In The Sky.

smackdown

When you as an enlightened elite are being ignored, well, that cannot stand.

I made kids kneel inside the classroom facing the wall. They were thus pained personally, and shamed by their peers.

I made kids lie down in the hot sand. This was painful and degrading.

I hit kids on the heads with dusty erasers. Their hair would be all white -- the intention was to amplify the strike with the disapproval of the kid's peers.

I hit kids on the heads with my knuckles. I recall one time in my second year teaching, one beautiful student named Daniel Ricard said after I had hit a companion of his, "Mr. Wingo never used to hit students."

I made kids go to the principal's office. This was a somewhat idle threat, to the extent that perhaps in the shuffle, the kid would get let off the hook. But this was not in my interest so I would follow through.

Once in the principal's office, the kid would get a talking to, with fear: the fear of damage. Almost always the damage would manifest itself: a whipping with a stick, or with a rubber pipe, or with a piece of a fan belt.

I recall a story that a fellow teacher told me of his principal, who had beat a student badly with the only thing at hand, the flat of a machete blade. The student got cut up a bit, and the family complained. The school ended up paying 500 Namibian dollars (about 80 euros) from the school fund -- the fund that the students paid to begin with.

why?

I tell you this tonight because the writing of it relieves my conscience in some sense; it tells my story, though not absolutely. Again in some sense I hope for that Christian construction of "redemption", in which the confessor somehow is understood.

I do not hope for forgiveness, for that is not of the readers of this weblog to give, I do not think. But understanding I do ask. Thank you.

dangling pointers

19 November 2008 10:38 AM (moon | lisp | azul | oblong | party barge | silver jews | music)

I have here three pointers into the ether.

with apologies to rubén darío

A conversation between Dave Moon, Dan Weinreb, and Cliff Click on Azul, a massive multiprocessor Java machine.

The Azul is a Java machine like the Symbolics that Moon and Weinreb worked on was a Lisp machine. Easily the most interesting read of the last week or two, via Michael Weber.

This one will be on the final exam.

house in order

The company I work for, Oblong Industries, just opened up their web site on Friday. Go check it out!

I like how they hook visitors with the videos, then pull a Yegge with all of the text they have there. I approve!

on repeat

Silver Jews' latest album, Lookout Mountain, Lookout Sea, is quite addictive. It's no American Water but I can't get enough of Party Barge.

Send us your coordinates, I'll send a Saint Bernard...

((lambda (x) ((compile x) x)) '(lambda (x) ((compile x) x)))

14 November 2008 11:01 PM (quine | scheme | guile | compilation)

Over the last couple days, I implemented a generic tower of compilers in Guile.

So for example, you have Scheme as a source language, which defines a compiler to GHIL (a scheme-like intermediate language, simpler and without macros), which defines a compiler to GLIL (a lower-level language), which defines a compiler to object code (the byte sequence of VM code).

The compiler takes the source and target language as parameters, and does a depth-first search on the compiler graph to figure out how to get there from here, so to speak.

All well and good you say, but there is a wrinkle, in that sometimes you actually want the result of the computation that you just compiled. This is most clearly the case at the REPL:

scheme@(guile-user)> ,compile 42
Disassembly of #<objcode 871bbd0>:

nlocs = 0  nexts = 0

   0    (make-int8 42)                  ;; 42
   2    (return)                        

scheme@(guile-user)> 42
$1 = 42

So in order not to pollute my delightfully generic compiler with special cases as to whether we want to actually execute the bytecode, I added a fake language, "value", adding a compiler from objcode to value.

I realized when writing about all of this that there is a subset of values that is valid Scheme, bending my language tower into a circle. I suspected a lurking quine, and after some poking and later inspiration from the internet, I found this one:

  ((lambda (x) ((compile x) x)) '(lambda (x) ((compile x) x)))

Delightful, no?

whoisi impressions

14 November 2008 0:19 AM (whoisi | blizzard | gnome | advogato)

what's wrong

For many years now, I've been wanting to jump on the RSS bandwagon, so I could be "in" on multivariate, decentralized conversations -- friends and colleagues blathering into the ether(net). You know the story.

But RSS readers: what a drag. I could never really articulate my quease, except that there was something that my beloved advogato and planet.gnome.org had that the RSS readers lacked.

That is, until today, while checking out whoisi: People aren’t Inboxes. The simple time ordering from the planets is far superior. Older entries can just drop off into the googletron.

what's right

Whoisi is right! In many ways:

  • No accounts, no login. You just go there and use it.

    Granted, you probably will want to read the people you're interested in from multiple computers -- in that case you're provided with a simple link that you can mail yourself.

  • No accounts, no login. Anyone can add identity to any person.

    This is a really bold piece of whoisi: Anyone can edit a person's identity. Since there are no accounts, there is no "me" -- it's all just people on the intertubes.

    This has the upside that you don't need your friends to join whoisi to "follow" them there, you can just add them yourself, attaching their public weblog feed, flickr photos, etc. Whoisi has the capacity to swallow the whole intertron, without diminishing its value as Facebook etc are apt to do.

  • Open data. All of the identities are available via simple web requests.

Whoisi has a couple of downsides currently though:

  • Some information is still proprietary.

    In particular, the set of people that you "follow" cannot be extracted from the site. Since the system doesn't have a notion of "you", the question is isomorphic to not being able to extract the followers of any particular anonymous, cookie-identified user. There's no answer to the question, "how many people are following XYZ person".

    On the other hand, exposing who a user reads has clear privacy concerns, and the site makes it easy enough to "follow" someone (one click! really!) that this is not a large expropriation of my data (i.e. I can easily recreate my list).

  • The site itself is not free software.

    Using a site like this is an investment of time and effort on my part -- one that probably pays off in the short term. But if Whoisi were to undergo an aggressive monetization a year from now, to the point that I wouldn't want to use the site any more, my investment could become a net loss.

    If Whoisi were free software, I would have peace of mind, knowing that if the site went bad, that I or others could set up a copy of my own for the subset of the intertron that I am interested in.

chocolate jesus

But all in all, I think the current balance is in Whoisi's favor -- I'm going to see about using it instead of planets.

Whoisi follows RSS' loose federation model, in which the reader chooses the writers, without intermediary editors. And as a side benefit, finally I can hear what people drop into the twitterbowl.

Convinced? Take a stroll around, and add yourself if you write. Let me know how it works out!

barna dispatch

12 November 2008 0:35 AM (barcelona | 22@ | cops | guile | scheme)

bcn: notes from the outskirts.


the cock of barcelona, evicting its inhabitants

22@ is the name given to the parasitic, life-sucking force that is engulfing Poble Nou. I snapped this photo biking by the other day: notice the cops in the lower right, fulfilling their functions as agents of property-holders.

I mean to write at some point about "good people and bad systems", but it is obvious to anyone at the wrong end of a porra whose interests the police serve. In this case, they are the Pinkertons, the private security service of the modern-day railroad trust, the unstoppable juggernaut of "development" in the city.


red clay, rolling to the badalona hills

Farther out, where I live, they talk about "revitalization", and the city's responsibility to neglected neighborhoods. I am deeply skeptical. Instead of fixing up decaying buildings, they prefer to demolish and build a kind of Disneyland yuppietopia -- gentrification just like in any other part of the world. Their care is not for those who inhabit the buildings, but for those who own them.

As an American, the whole "development" situation in Spain is incredibly frustrating: I know where they're going, I've seen it in the states. The US is just starting to reap the rotten fruit of suburban dissociation, but Spain continues to tear down the livable to construct the profitable. You will give reason to your own Kunstlers, don't you understand.

hack

A REPL for one of Guile's intermediate languages, and proof that Scheme will never be faster than C. Enjoy them both!

election night drinking games

3 November 2008 9:46 PM (drink)

Mike Smith, on loan to San Francisco from Melbourne, notes that the internet is awash in hits for the phrase, "election night drinking games".

This is excellent.

A number of writers suggest the provision of drinks in Red and Blue flavors, representing the gamut of taste that is tasteable in America:

Take a sip of your red drink if:

  • McCain wins a state.

  • Anyone utters the word "maverick."

  • Joe the Plumber makes an appearance. (double points if he's gotten his plumber's license)

  • A pundit implies that Sarah Palin is hot.

Others dispense with the color-flavoring, but still recommend drinking by color:

The election night drinking game is simple and guaranteed to keep you drinking for hours. And if this is anything like the last two elections, you might want to get ready for a three day bender.

All you need to do is gather your friends and buy copious amounts of alcohol. Then divide the blue and red states amongst yourselves. You might pick the blue states if you voted Democratic or drink for the red states to drown your sorrows at the possibility of McCain becoming president.

Both of these high-ranked Google hits come from Florida. I wonder why.

The theme of "take a drink if" reaches higher heights with my favorite, from The Modern Gal, the Joe Sixpack Uno Shout:

Every time a battleground state is called for one candidate or the other, the first person to yell "Joe Sixpack" gets to distribute six drinks among as many people as they would like. If you're drinking alone, you might as well drain your drink. It's going to be a long, lonely night.

Me, I'll be avoiding the Displaced Aristocracy Democrats Abroad 30-euro teleganza, but I will find a place to partake in these games. It's for the sport, you see.

guile bar mitzvah

2 November 2008 1:50 AM (guile | scheme | compilation)

Friends, neighbors, &c: ahem! May I present a new compiler!

checkout

Check out and build the vm branch of the Guile repository:

git clone git://git.sv.gnu.org/guile.git
git checkout -b vm origin/vm
./autogen.sh && ./configure && make

If you haven't ever run Guile before, do yourself a favor and enable readline and the value history:

cat > ~/.guile <<EOF
(use-modules (ice-9 readline) (ice-9 history)
(activate-readline)
EOF

the unboxing

Fire it up, foolios!

$ ./pre-inst-guile
Guile Scheme interpreter 0.5 on Guile 1.9.0
Copyright (C) 2001-2008 Free Software Foundation, Inc.

Enter `,help' for help.
scheme@(guile-user)>

I must say, Guile starts up in a lovely and friendly fashion these days.

The scheme part of the prompt indicates the current language. Those of you that are a bit longer in the tooth may recall the TCL wars, in which Guile was born as an attempt to be a common language runtime for all of free software. Part of the idea was that many languages could be compiled to Guile Scheme, which could run them all together in some kind of Harmony.

So, the idea failed, for many reasons. But the basics remain sound: if you have an open, layered compiler, and a VM that you control, there's no reason why you shouldn't be able to replace the top layer or two of the compiler with something that accepts, for example, Emacs Lisp.

I digress. The prompt tells us that we are in the scheme language, in the (guile-user) module -- and it's waiting with bated breath for us to type in an expression. I'll just show the prompt as > from now on.

> 1.0
$1 = 1.0

OK, it does react to us! The $1 = part of the output is what (ice-9 history) does for us, by the way. But what to do now? Hm... Better see what was going on with that help thing...

> ,help

Help Commands [abbrev]:

 ,help [GROUP]                 [,h] - List available meta commands.
 ,apropos REGEXP               [,a] - Find bindings/modules/packages.
 ,describe OBJ                 [,d] - Show description/documentation.
 ,option [KEY VALUE]           [,o] - List/show/set options.
 ,quit                         [,q] - Quit this session.

Command Groups:

 ,help all                          - List all commands
 ,help module                       - List module commands
 ,help language                     - List language commands
 ,help compile                      - List compile commands
 ,help profile                      - List profile commands
 ,help debug                        - List debug commands
 ,help system                       - List system commands

Type `,COMMAND -h' to show documentation of each command.

See, this is what I really like about GNU. There is a culture of the command line in all GNU software. Here we see that there is loads of interactive documentation and functionality available to us, in a system which has the Emacs nature: self-describing, and extensible within its own language.

One of my favorite commands is ,disassemble, abbreviated as ,x:

> (define (hello) (display "Hi mom!") (newline))
> ,x hello
Disassembly of #<program hello ()>:

Bytecode:

   0    (late-variable-ref 0)           ;; `display'
   2    (object-ref 1)                  ;; "Hi mom!"
   4    (call 1)                                              at (unknown file):1:16
   6    (drop)                          
   7    (late-variable-ref 2)           ;; `newline'
   9    (goto/args 0)                                         at (unknown file):1:36

In this particular case there's not much going on. The thing to note is that since we haven't run the procedure yet, the toplevel variables haven't yet been looked up (the late-variable-ref calls above), so they print as symbols. The locations corresponding to those symbols will be cached when the procedure is first called, relative to the module that was current when `hello' was defined.

As you can see, the VM that the compiler is targetting is a simple stack machine. There are only three registers: the stack pointer, the current frame pointer, and the instruction pointer. This simple model maps fairly directly to Scheme's semantics.

Programs, the name given to compiled procedures, are code with data: they have a static array associated with all invocations of the procedure (as in the object-ref above), and a list of heap-allocated values, the external list:

> ,x (let ((x 10)) (lambda () (set! x (* 2 x)) x))
Disassembly of #<program #(0 28 #f) ()>:

Bytecode:

   0    (make-int8 2)                   ;; 2
   2    (external-ref 0)                ;; (closure variable)
   4    (mul)                           
   5    (external-set 0)                ;; (closure variable) at (unknown file):0:28
   7    (external-ref 0)                ;; (closure variable)
   9    (return)                        

Externals:

   0    10                              

It's interesting, it seems you need to allocate lexicals on the heap in two circumstances: one, if they are lexically referenced by some procedure, or two, if they are ever mutated. The latter point is a bit subtle, but in the presence of call/cc, you need to capture the identity of variables, not their values.

So it turns out that what you think is "closer to the metal", viz. set!, actually forces the compiler to take the less efficient route. (Of course the Haskell people know this already.)

There are some optimizations that can be made, but in general if you call out to a separately compiled procedure, you have no idea what that procedure will do -- so you need to allocate mutated variables on the heap.

status

Of course, anyone can make a toy compiler for a toy language. So what's the big deal here? Well to me, for my own code, the beauty is that it's not a "toy compiler": there is a large corpus of Guile code out there, and this compiler aims to interoperate with just about all of it.

So anything that is out there that is valid Guile should run just fine with compiled code. It's taken a bit of work, over the past six months or so, but I think we're pretty much at that state.

Furthermore, we permit the intermixing of the existing routines that are hard-coded in C, with the existing code that runs in the memoizer/interpreter, and with whatever subset of the existing code that has been run through the compiler. You can call seamlessly from one to the other.

Currently Guile's compiler is only slightly faster than its evaluator -- which is to be expected in many ways. The evaluator was tuned over many years to reach its current speed, and the VM still has many paranoid checks enabled in its source code. I expect that over time, VM code will be faster than the evaluator by a factor of about 5 or 10.

More than that, having compiled source to bytecodes gives us a nice low-level format to work with, highly amenable to JIT compilation to native code. This is where I really want to go -- it won't much matter in cases like the ones given above, but in highly computational algorithms this will be the difference between the delight of coding in Scheme and the drudgery of C.

history

I started on this project because I had a social investment in Guile, and wanted my own code to run faster. Luckily, Keisuke Nishida already did all of the hard work for me.

Working with Kei's code has been incredibly enlightening, we've been having conversations, displaced in time: I come up with the questions, then I notice the answers already in the source. I have never actually corresponded with Keisuke in the conventional sense. This is a beautiful and strange thing about free software.

Since then, the code passed through Ludovic Courtès' hands for some years, then I unearthed it and brought it to where it is today. It's been a pleasing task, having all of the right decisions already made for you, just having to fill in the missing bits.

I should also mention that I had no idea how to write a compiler -- Ghuloum's beautiful paper notwithstanding. But seeing code that breaks it down into levels that I understand has empowered me as a programmer to create things that I did not think possible.

what rough beast, its hour come round at last

The way I reckon it, Guile is at least 13, so a coming-of-age ceremony is appropriate. Once the VM branch gets merged to master, we'll start to get the gears in motion for a Guile 2.0 -- source-compatible, but much faster.

If you, dear reader, have been piqued by any of this: well by all means subscribe to guile-devel, where the wonderful things happen.

The pleasant thing about all this is that it's a small group of people, and that one individual working hard and working smart can make an enormous difference. So come along and play out those compiler optimization fantasies that you've been keeping secret!

dynamic dispatch: a followup

19 October 2008 10:40 PM (guile | goops | clos | dispatch | dynamic | self | pic | polymorphic inline caches)

It seems that the 8-hash technique for dynamic dispatch that I mentioned in my last essay actually has a longer pedigree. At least 10 years before GOOPS' implementation, the always-excellent Gregor Kiczales wrote, with Luis H Rodriguez Jr.:

If we increase the size class wrappers slightly, we can add more hash seeds to each wrapper. If n is the number of hash seeds stored in each wrapper, we can think of each generic function selecting some number x less than n and using the xth hash seed from each wrapper. Currently we store 8 hash seeds in each wrapper, resulting in very low average probe depths.

The additional hash seeds increase the probability that a generic function will be able to have a low average probe depth in its memoization table. If one set of seeds doesn't produce a good distribution, the generic function can select one of the other sets instead. In effect, we are increasing the size of class wrappers in order to decrease the size of generic function memoization tables. This tradeoff is attractive since typical systems seem to have between three and five times as many generic functions as classes.

Efficient method dispatch in PCL

So it seems that Mikael Djurfeldt, the GOOPS implementor, appears to have known about CLOS implementation strategies. But it's interesting how this knowledge percolates out -- it's not part of the computer science canon. When you read these papers, it's always "Personal communication from Dave Moon this" and "I know about this Kiczales paper that". (Now you do too.)

Also interesting about the Kiczales paper is the focus on the user, the programmer, in the face of redefinitions -- truly a different culture than the one that is dominant now.

polymorphic inline caches buzz buzz buzz

This reference comes indirectly via Keith Rarick, who writes to mention a beautiful paper by Hölzle, Chambers, and Ungar, introducing polymorphic inline caches, a mechanism to dispatch based on runtime types, as GOOPS does.

PICs take dispatch one step further: instead of indirect table lookups as GOOPS does, a PIC is a runtime-generated procedure that performs the lookups directly in code. This difference between data-driven processing and direct execution is the essence of compilation -- compilation pushes all of the caching and branching logic as close to the metal as possible.

Furthermore, PICs can be a source of data as well as a dispatch mechanism:

The presence of PIC-based type information fundamentally alters the nature of optimization of dynamically-typed object-oriented languages. In “traditional” systems such as the current SELF compiler, type information is scarce, and consequently the compiler is designed to make the best possible use of the type information. This effort is expensive both in terms of compile time and compiled code space, since the heuristics in the compiler are tuned to spend time and space if it helps extract or preserve type information. In contrast, a PIC-based recompiling system has a veritable wealth of type information: every message has a set of likely receiver types associated with it derived from the previously compiled version’s PICs. The compiler’s heuristics and perhaps even its fundamental design should be reconsidered once the information in PICs becomes available [...].

Optimizing Dynamically-Typed Object-Oriented Programming Languages with Polymorphic Inline Caches

The salient point is that in latent-typed languages, all of the static type analysis techniques that we know are insufficient. Only runtime analysis and runtime recompilation can capture the necessary information for efficient compilation.

Read both of these articles! But if you just read one, make it the Ungar/Chambers/Hölzle -- it is well-paced, clearly-written, and illuminating.

Happy hacking!