At Mon, 7 Mar 2016 03:52:39 -0800 (PST), brendan wrote:
> I'm sure I'm missing something obvious here. In the Guide, introducing syntax 
> objects, it says:
> 
> "Most notably, free-identifier=? determines whether two identifiers refer to 
> the same binding:
> 
> ...
> 
> (free-identifier=? #'car (let ([car 8])
>                              #'car))
> 
> The last example above, in particular, illustrates how syntax objects 
> preserve 
> lexical-context information."
> 
> To me it looks suspiciously like those two identifiers refer to different 
> bindings.

Yep, that example is broken with the new (as of v6.3) macro system.

If we use the longhand form `(quote-syntax .... #:local)`, then the
example works as intended:

 > (free-identifier=? #'car (let ([car 8])
                              (quote-syntax car #:local)))
 #f

The problem is that #' prunes some scopes to make it better with
certain macro patterns. That scope pruning works well in a macro
implementation, but it's not so great for examples outside of a macro
implementation that are intended to probe bindings.

For more information on why #' prunes some scopes, see

http://www.cs.utah.edu/plt/scope-sets/general-macros.html#%28part._.Local_.Bindings_and_.Syntax_.Quoting%29


I'll fix the broken example in the docs.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to