On Sep 20, 2009, at 9:50 PM, David Van Horn wrote:
Abdulaziz Ghuloum wrote:
On Sep 20, 2009, at 8:00 PM, David Van Horn wrote:
OK, I've moved syntax.sls to syntax.larceny.sls since it seems to
make Larceny specific assumptions beyond just single instantation,
but also that hash tables can be shared across phases.
Ikarus too shares data structures across phases (single
instantiation of libraries). But even in larceny, that code is
still broken when you separately compile libraries.
OK, I'll try to resolve the issue before the thing goes final.
Thanks for your help.
BTW, I think the organization of the library is a little unwieldy (8
files in 5 hierarchical levels is a little too many). If I may
suggest that you revert to the single-library implementation that was
there before and use the following portable implementation for quote.
Leave it up to the individual implementors to choose better
implementations if they so wish. Code:
(define get-cached
(let ([h (make-eq-hashtable)])
(lambda (x)
(define (f x)
(cond
[(pair? x) (ir:cons (f (car x)) (f (cdr x)))]
[(vector? x) (vector-map f x)]
[else x]))
(cond
[(not (or (pair? x) (vector? x))) x]
[(hashtable-ref h x #f)]
[else
(let ([v (f x)])
(hashtable-set! h x v)
v)]))))
(define-syntax ir:quote
(syntax-rules ()
[(_ datum) (get-cached 'datum)]))
Aziz,,,