[plt-scheme] Where is macroexpand in PLT Scheme?
On Tuesday, November 11, 2003, at 01:51 PM, Bill Clementson wrote:
>
> --- John Clements <clements at brinckerhoff.org> wrote:
>> IIRC, you're a non-Dr user, and probably won't be
>> happy with this
>> answer, but:
>
> I use DrScheme sometimes too. I find Emacs a very
> productive environment; however, I am not an editor
> bigot. I think that some of the things that have been
> done in DrScheme are very innovative.
>
>> Have you looked at the 'Expander' language level in
>> DrS? It shows the
>> expansion of the Def'n's frame, and allows you to
>> click on any element
>> of the expansion to see what its origin is.
>
> How does one use this feature? I selected "expander"
> as the language level and clicked "Check Syntax". All
> of my code is then colored green with the exception of
> the comments which are colored brown (e.g. - there is
> no keyword-specific coloring as is usually displayed
> for other language levels). Double-clicking on a macro
> name doesn't take me to the macro, nor are there any
> right-click options. If I search for "expander" in the
> Help Desk, I get no results.
Ha! Funny, just this morning I was thinking that perhaps 'Check
Syntax' should be disabled in the Expander language. No, you click on
Execute. That is, the Expander language level is one that elaborates
the user's code into code that expands and displays itself.
>
>> The basic problem is that--as you've
>> inferred--flattening the
>> syntax-objects with syntax-object->datum loses
>> information. This
>> information includes the lexical scope that the s-o
>> has (used for
>> resolving bindings), and the source position (used
>> for giving good
>> error messages). In fact, you can attach anything
>> you want to a syntax
>> object (using syntax-property)--this is used, e.g.,
>> for the stepper to
>> attach information during macro expansion that is
>> used to reverse that
>> expansion.
>
> Stepper is a neat tool - it's unfortunate that it only
> works at the lower language levels. Are you aware of
> any programs that are doing interesting things with
> syntax objects other than stepper? I would like to see
> some good examples of how people are using this
> language feature.
Very unfortunate, I agree. Mea Culpa.
Yes, syntax properties are used by a variety of tools. grep for
'syntax-property' in the collects tree (and prune out the 'doc'
collection), and you'll see hits in the compiler, the teachpack code,
the Check Syntax tool, the stacktrace/errortrace, the language level
implementations, the contract library, and all over the stepper.
john