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

From: Asumu Takikawa (asumu at ccs.neu.edu)
Date: Tue Jan 21 22:23:20 EST 2014

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

Posted on the users mailing list.