[plt-scheme] Check Syntax & mangled identifiers

From: Tom Schouten (tom at zwizwa.be)
Date: Sat May 23 09:35:36 EDT 2009

Hi Sam,

> I believe that you can use the 'disappeared-binding and
> 'disappeared-use syntax properties to do this.
> http://docs.plt-scheme.org/reference/stxprops.html

I seem to be doing something wrong as the behaviour doesn't
change with these properties added.  Hovering over the ``x''
doesn't give any arrows, while the ``_x'' points to the 
#`(let ...) form.


#lang scheme

(require (for-syntax scheme))

(define-for-syntax (underscore stx)
  (datum->syntax stx
                  (format "_~a"
                          (syntax->datum stx)))))

(define-syntax (u stx)
  (syntax-case stx ()
    ((_ (name val) . body) 
      #`(let ((#,(underscore #'name) val)) . body)
      'disappeared-binding (list #'name)))
    ((_ id) 
      (underscore #'id)
      'disappeared-use #'id))))

;; case 1
(u (x 123) (u x))

;; case 2
(let ((_x 123)) (u x))
(u (x 123) _x)

Posted on the users mailing list.