| by Arround The Web | No comments

Andy Wingo: micro macro story time

Today, a tiny tale: about 15 years
ago
I was working
on Guile’s macro
expander
.
Guile inherited this code from an early version of Kent Dybvig’s
portable syntax
expander
. It
was... not easy to work with.

Some difficulties were essential. Scope is tricky, after all.

Some difficulties were incidental, but deep. The expander is ultimately
a function that translates Scheme-with-macros to Scheme-without-macros.
However, it is itself written in Scheme-with-macros, so to load it on a
substrate without macros requires a pre-expanded copy of
itself
,
whose data representations need to be compatible with any incremental
change, so that you will be able to use the new expander to produce a
fresh pre-expansion. This difficulty could have been avoided by
incrementally bootstrapping the
library
. It
works once you are used to it, but it’s gnarly.

But then, some difficulties were just superflously egregious. Dybvig is
a totemic developer and researcher, but a generation or two removed
from me, and when I was younger, it never occurred to me to just email
him to ask why things were this way. (A tip to the reader: if someone
is doing work you are interested in, you can just email them. Probably
they write you back! If they don’t respond, it’s not you, they’re probably just
busy and their inbox leaks.) Anyway in my totally speculatory reconstruction of events,
when Dybvig goes to submit his algorithm for publication, he gets annoyed that “expand”
doesn’t sound fancy enough. In a way it’s similar to the original SSA
developers thinking that “phony functions” wouldn’t get
published
.

So Dybvig calls the expansion function “χ”, because the Greek chi looks
like the X in “expand”. Fine for the paper, whatever paper that might
be, but then in psyntax, there are all these functions named
chi and chi-lambda and all sorts of nonsense.

In early years I was often confused by these names; I wasn’t in on the
pun, and I didn’t feel like I had enough responsibility for this code to
think what the name should be. I finally broke down and changed all
instances of “chi” to “expand” back in 2011, and never looked back.

Anyway, this is a story with a very specific moral: don’t name your
functions chi.

Share Button

Source: Planet GNU

Leave a Reply