Uninterned symbols are stored incorrectly
Issue #101
resolved
This should not raise an error when the library is read from cache:
;; test-lib.scm
(library (test-lib)
(export foo)
(import (rnrs))
(define-syntax define-inline
(syntax-rules ()
((_ (?name ?arg ... . ?rest) ?form0 ?form ...)
(define-syntax ?name
(syntax-rules ()
((_ ?arg ... . ?rest)
(begin ?form0 ?form ...)))))))
(define-syntax define-foo
(lambda (x)
(syntax-case x ()
((_ foo)
(with-syntax (((boo) (generate-temporaries #'(#f))))
(write #'boo) (newline)
#'(begin
(define-inline (foo) (boo))
(define (boo) 'buz)))))))
(define-foo foo)
)
(import (test-lib))
(foo)
and got (from cache):
*error*
#<condition
&undefined
&who #:temp9
&message unbound variable #:temp9 in library (test-lib)
>
stack trace:
[1] #f
src: (#:temp9)
[2] load
Comments (3)
-
reporter -
reporter - changed status to resolved
checking shared state during macro caching to share uninterned symbol between closures and macros (Fixes
#101)→ <<cset 005aecb40b44>>
-
reporter generate-temporaries now doesn't use gensym to generate symbols (Fixes
#101)→ <<cset ef9a2f63dc92>>
- Log in to comment
The issue is a bit more compilcated than I expected. In short, we shouldn't use gensym for generate-temporaries. The generated symbols may be used on difference cache unit. For example, libA provides the code described on the issue and libB uses it. Then libB, in general, refers the uninterned symbol defined in libA. However if it's in cache then it won't be the same symbol.
The resolution would, for now, only be generates unique enough interned symbols.