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

From: Patrick Boe (patrickboe at gmail.com)
Date: Wed Jan 22 06:55:46 EST 2014

Matt, Asumu,

Thank you, I had noticed and become confused by the same thing Greg brought
up with plain-app in the expression grammar.  I'll have to start paying
more attention to the asides in the Reference.

At any rate, your help got me rolling again.  It turns out that the
annotate function can handle the expanded syntax from my last email with no
problems - so I guess the pattern match uses free-identifier=? when looking
for #%plain-app.  I'm going to have to investigate why this works on syntax
from a call to expand but not within the transformer of a define-syntax
macro, but I'm no longer totally stumped.


On Tue, Jan 21, 2014 at 10:23 PM, Asumu Takikawa <asumu at ccs.neu.edu> wrote:

> On 2014-01-21 22:00:37 -0500, Greg Hendershott wrote:
> > I get:
> >
> >     '(module foo scheme
> >        (#%module-begin
> >         (define-values (a) '3)
> >         (#%app call-with-values (lambda () (#%app + a '4))
> print-values)))
>
> I think what's happening here is that the symbolic name of an identifier
> often does not reflect the actual binding of the identifier.
>
> In particular, consider this interaction:
>
>   -> (define stx (parameterize ([current-namespace (make-base-namespace)])
>                    (expand
>                     (datum->syntax
>                      #f
>                      '(module foo scheme
>                        (define a 3)
>                        (+ a 4))))))
>   -> (define id (syntax-parse stx [(_ _ _ (_ _ _ (?#%app _ _ _)))
> #'?#%app]))
>   -> (free-identifier=? id #'#%app)
>   #f
>   -> (free-identifier=? id #'#%plain-app)
>   #t
>
> IOW, the ground truth is reflected by `free-identifier=?` but not the
> name. In particular, note this bit from the margin note in Section
> 1.2.3.1 of the Reference:
>
>   Beware that the symbolic names of identifiers in a fully expanded
>   program may not match the symbolic names in the grammar. Only the
>   binding (according to free-identifier=?) matters.
>
> Cheers,
> Asumu
> ____________________
>   Racket Users list:
>   http://lists.racket-lang.org/users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20140122/c3da8114/attachment-0001.html>

Posted on the users mailing list.