The following puzzles me:
 
#lang racket
(define plus +)
(free-identifier=? #'+ #'plus) ; -> #f
 
#lang racket
(define-syntax (a stx)
 (syntax-case stx ()
  ((_) (datum->syntax stx (free-identifier=? #'+ #'plus)))))
(define plus +)
(a) ; -> #f
 
#lang racket
(define plus +)
(define-syntax (a stx)
 (syntax-case stx (+)
  ((_ +) #'#t)
  ((_ x) #'#f)))
(a plus) ; -> #f
 
I am confused, because I expect #t to be produced in the three above cases.
Obviously I don't understand free-identifier=? well.
Can you help me with that?
 
As another question: the docs on syntax-case state:
 
"An id that has the same binding as a literal-id matches a syntax object
that is an identifier with the same binding in the sense of
free-identifier=?
<file:///C:/Program%20Files/Racket/doc/reference/stxcmp.html?q=syntax-case#%
28def._%28%28quote._~23~25kernel%29._free-identifier~3d~3f%29%29> .
The match does not introduce any
<file:///C:/Program%20Files/Racket/doc/reference/stx-patterns.html?q=syntax-
case#%28tech._pattern._variable%29> pattern variables."
 
Why isn't or cant't the match introduce a pattern variable?
Without binding the literal-id as a pattern variable,
location information is lost, for example:
 
#lang racket
(error-print-source-location #t)
(begin-for-syntax (error-print-source-location #t))
(define-syntax (a stx)
 (syntax-case stx (+)
  ((_ +) (raise-syntax-error 'a "msg" stx #'+)))) ; <---
(a +)
 
raises a syntax-error as expected, but it highlights + in the line marked
<---,
not in the last line.
I would prefer the + in the last line to be highlighted.
 
(I am running DrRacket, version 6.1.1 [3m])
 
Help very much appreciated.
 
Wish all of you a fine easter,
Jos Koot
 

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to