I was examining my TODO list for Ocean (which is of decent length and, my being all for technology and all, is kept entirely on paper) and decided I had to pick the next task to really go at. Numeric tower support is almost done and is largely a matter of detail which, while important, needs to be broken up for the sake of keeping me awake and sane (so help me if I have to write another override operator function...). In the end, I selected to start work implementing macros. It was an arbitrary choice, but one that makes sense in light of the research I'd been doing on Scheme compilation.

As I read and reread the pages from the current (R5.92RS) draft, a few thoughts occurred to me. The most obvious was that I was here preparing to implement a feature in Scheme that I had not used to date. I have used macros sparingly in C/C++, but never in Scheme. I just never really saw a reason in the things I was doing with it. The second thought was that Scheme's macros seem to hold almost as much worth, if not more, for the language implementor. It seems like an interesting thought, doesn't it? Macros are expanded prior to interpretation/compilation (as the case may be), so they can be used in the process of interpretation/compilation--and that is what many systems (including Ocean, when it gets that far) do: define a core set of forms and everything else as default macros based on those forms. It's an interesting exercise to try and think of ways to rewrite common Scheme constructs as macros. A simple macro for the let form could be:

(let ((x 1) (y 2)) ) -> ((lambda (x y) ) 1 2)

Interesting, huh?