From 51a317b3b0bee2c411b68da36da39264b4b18ffa Mon Sep 17 00:00:00 2001 From: Rob Browning Date: Mon, 25 Feb 2002 05:49:05 +0000 Subject: [PATCH] * 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. --- ice-9/syncase.scm | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/ice-9/syncase.scm b/ice-9/syncase.scm index 36ea4f962..dc8c321c7 100644 --- a/ice-9/syncase.scm +++ b/ice-9/syncase.scm @@ -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)