[plt-scheme] Check Syntax & mangled identifiers
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
(string->symbol
(format "_~a"
(syntax->datum stx)))))
(define-syntax (u stx)
(syntax-case stx ()
((_ (name val) . body)
(syntax-property
#`(let ((#,(underscore #'name) val)) . body)
'disappeared-binding (list #'name)))
((_ id)
(syntax-property
(underscore #'id)
'disappeared-use #'id))))
;; case 1
(u (x 123) (u x))
;; case 2
(let ((_x 123)) (u x))
(u (x 123) _x)