Bill Clementson's Blog

Bits and pieces (mostly Lisp-related) that I collect from the ether.

November 2003
Sun Mon Tue Wed Thu Fri Sat
1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30
Oct  Dec

DrScheme expander language

Monday, November 10, 2003

I posted my "Where is macroexpand in PLT Scheme?" question (that I was commenting on yesterday) to the PLT Scheme mailing list and got some interesting replies. In DrScheme, the implementers have taken the novel approach of creating an expander language for Scheme. Basically, to use it, you just select "Expander" as the language (under "Choose Language...") in DrScheme. You then load a Scheme source file and press the Execute button. This will result in the "syntax objects" that make up the Scheme source file being displayed (in a collapsed form) in the Interaction window. You can open up each "syntax object" (there is one for each top-level sexp) and view the expanded source for the sexp. In addition, on the right-hand side of the expanded source display, there is some general information about the sexp (things like the source file, module, location in file, original source statement).

There are some things that I don't like about the approach they've taken (in particular, I would have preferred to see an "expand-to-top-form" type of expansion instead of the "intermediate" form that they've chosen); however, I think that what they've done is unique (I haven't seen any other editor take this type of appoach for any other language). The things I like about it are:

I think that any tool that helps a programmer think about his code in different ways and from different angles/perspectives is a "good thing".

emacs Copyright © 2004 by Bill Clementson