[racket] free-id-table-ref odd behavior
Figured it out. Had to make table with #:phase -1
-Ian
----- Original Message -----
From: "J. Ian Johnson" <ianj at ccs.neu.edu>
To: "users" <users at racket-lang.org>
Sent: Thursday, November 22, 2012 11:26:25 AM GMT -05:00 US/Canada Eastern
Subject: [racket] free-id-table-ref odd behavior
I'm making my first macro that communicates across uses via compile-time mutation. Somehow my entries are not being looked up correctly.
Say I have a compile-time table:
(define-for-syntax optional (make-free-id-table))
That in the first invocation is populated with #'state \mapsto (list foo bar)
The second invocation needs info about #'state (and is given as part of the macro input. I try to look up the list with (get-op #'parameter-bound-to-state)
(define-for-syntax (get-op id)
(free-id-table-for-each optional
(λ (id* v) (printf "Found? ~a ~a~%" #'id* (free-identifier=? id id*))))
(free-id-table-ref optional id
(λ () (raise-syntax-error #f "Unregistered struct" id))))
This prints "Found? state #t" and then errors on the ref.
What's going on?
-Ian
____________________
Racket Users list:
http://lists.racket-lang.org/users