[racket] How ought I run the annotate function in gui-debugger/annotator on a datum?

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Tue Jan 21 22:20:07 EST 2014

At Tue, 21 Jan 2014 22:00:37 -0500, Greg Hendershott wrote:
> But when I try the example for `expand`:
> 
>     (parameterize ([current-namespace (make-base-namespace)])
>       (syntax->datum
>        (expand
>         (datum->syntax
>          #f
>          '(module foo scheme
>            (define a 3)
>            (+ a 4))))))
> 
> I get:
> 
>     '(module foo scheme
>        (#%module-begin
>         (define-values (a) '3)
>         (#%app call-with-values (lambda () (#%app + a '4)) print-values)))
> 
> Notice that it uses #%app -- not #%plain-app. Apparently `expand`
> doesn't actually emit something that fits the spec for "Fully Expanded
> Programs".

The `#%app` that you see there is `free-identifier=?` to `#%plain-app`,
not the `#%app` from `racket/base', so it matches the grammar -- at
least as the grammar is intended to be read.

I know that this is confusing. We've tried to explain in the
documentation in a couple of ways (a margin note and text after the
grammar), but even with better words, no one is going to look at the
grammar in the documentation and think "I should read the surrounding
text to see whether `#%plain-app` is going to be spelled `#%app`."


Posted on the users mailing list.