mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-05-01 20:30:28 +02:00
* syncase.scm (gensym): redefine locally so we can control it's
properties. This is in preparation for changing the future public gensym to produce unreadable symbols.
This commit is contained in:
parent
9970456903
commit
51a317b3b0
1 changed files with 23 additions and 0 deletions
|
@ -149,6 +149,29 @@
|
|||
|
||||
(define generated-symbols (make-weak-key-hash-table 1019))
|
||||
|
||||
;; We define our own gensym here because the Guile built-in one will
|
||||
;; eventually produce uninterned and unreadable symbols (as needed for
|
||||
;; safe macro expansions) and will the be inappropriate for dumping to
|
||||
;; pssyntax.pp.
|
||||
;;
|
||||
;; syncase is supposed to only require that gensym produce unique
|
||||
;; readable symbols, and they only need be unique with respect to
|
||||
;; multiple calls to gensym, not globally unique.
|
||||
;;
|
||||
(define gensym
|
||||
(let ((counter 0))
|
||||
(lambda (. rest)
|
||||
(let ((val (number->string counter)))
|
||||
(set! counter (+ counter 1))
|
||||
(cond
|
||||
((null? rest)
|
||||
(string->symbol (string-append "syntmp-" val)))
|
||||
((null? (cdr rest))
|
||||
(string->symbol (string-append "syntmp-" (car rest) "-" val)))
|
||||
(else
|
||||
(error
|
||||
"syncase's gensym called with the wrong number of arguments")))))))
|
||||
|
||||
;;; Load the preprocessed code
|
||||
|
||||
(let ((old-debug #f)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue