[racket] Check syntax and disappearing bindings

From: Robby Findler (robby at eecs.northwestern.edu)
Date: Sun Aug 14 09:20:59 EDT 2011

Yes, those are the properties that you want. I guess the problem is
that the identifiers don't actually bind each other (rather than Check
Syntax not finding the properties).

For example, this macro works fine:

  (define-syntax (m stx)
    (syntax-case stx ()
      [(_ id1 id2)
         'disappeared-use (list (syntax-local-introduce #'id1)))
        'disappeared-binding (list (syntax-local-introduce #'id2)))]))

When you put the syntax object into a property, then it doesn't get
the cancelling mark that the expander puts on when a syntax object is
returned from a transformer, so you have to put it on yourself. At
least that's one way to do it.

I added a note about this to the Check Syntax section of the plugins
manual plus a pointer to a relevant helper library.


On Fri, Aug 12, 2011 at 4:18 PM, Vincent St-Amour <stamourv at ccs.neu.edu> wrote:
> I have a macro that restructures `let' binding lists, and I would like
> to have it play nice with Check Syntax.
> Here's an example:
> (let ([x 1.2+3.4i])
>  body ...)
> is expanded to:
> (let ([x-real 1.2]
>      [x-imag 3.4])
>  body ...)
> with references to `x' replaced by references to `x-real' and `x-imag'
> appropriately.
> The macro works fine, but causes Check Syntax to not draw arrows
> between uses of `x' in the body and the binding occurrence of
> `x'. Which makes sense, given that none of these are present in the
> fully expanded code.
> It seems that the 'disappeared-binding syntax property may be what I
> want, but I haven't figured out how to use it, and the documentation
> does not say much about it.
> I tried adding the 'disappeared-binding property with a list
> containing the syntax object corresponding to the binding occurrence
> of `x' as value, and 'disappeared-use properties with the syntax
> objects corresponding to the references to `x' that were removed.
> I tried adding these syntax properties in various places in the
> program, but couldn't get Check Syntax to show the arrows.
> Is 'disappeared-binding what I want? If so, where do I need to put the
> property to get Check Syntax to recognize it?
> Vincent
> _________________________________________________
>  For list-related administrative tasks:
>  http://lists.racket-lang.org/listinfo/users

Posted on the users mailing list.