[<<][staapl][>>][..]
Sat May 23 06:48:05 CEST 2009

disappeared-use

I'm trying to get check-syntax to work for prefixed identifiers.
These don't seem to do what I think they do:

   (syntax-property
      (ns-tx #`(_  (namespace ...) name))
      'disappeared-use #'name))

   (syntax-property
      (ns-prefixed #'(namespace ...) n)
      'disappeared-binding n)))


Let's ask:

Hello,

In the following, is there a way to instruct Check Syntax to recognize
the #'x identifier in reference and binding position as in case 1, or
in its relation to the #'_x identifier as in case 2 ?

----
#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) #`(let ((#,(underscore #'name) val)) . body))
    ((_ id) (underscore #'id))))

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

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

Cheers,
Tom


ANSWER:

Delivery-date: Sat, 23 May 2009 23:35:03 +0200
From: Chongkai Zhu <czhu@cs.utah.edu>
To: Tom Schouten <tom@zwizwa.be>
CC: Sam TH <samth@ccs.neu.edu>, plt-scheme@list.cs.brown.edu
Subject: Re: [plt-scheme] Check Syntax & mangled identifiers

Just keep the srcloc and the original prop of the identifier seems to be
enough for me.

Chongkai

#lang scheme
(require (for-syntax scheme))

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

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

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

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




[Reply][About]
[<<][staapl][>>][..]