[plt-scheme] question about question mark

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Wed Jun 20 18:55:44 EDT 2007

At Sun, 17 Jun 2007 17:31:35 +0200, "Jos Koot" wrote:
> Hi,
> I wonder why check syntax shows a question mark pointing from var to var in 
> the 
> following code:
> 
> (module x mzscheme
>  (define var 1) ;  -------------------------------------
>  (define-syntax x (syntax-rules ()  ((_) var))) ; ?<-----
>  (provide x))
> 
> I am rather pleased with the certainty that the variable is bound as defined 
> in 
> the module.

If you change the example slightly:

 (module x mzscheme
  (define var 1)
  (define-syntax x (syntax-rules ()  ((_ f) (f var))))
  (provide x))

then `var' may not refer to the definition in the `x' module after all,
depending on what `f' turns out to be. (It might be `quote', for
example.)

It's possible that Check Syntax could be made smart enough to say that
`var' in the original example definitely refers to the definition; I'm
not sure what form the specification of Check Syntax's behavior would
have to take to make that possible, though.

Instead, Check Syntax always draws "?"-annotated arrows from
identifiers in templates.

Matthew



Posted on the users mailing list.