From 05083d4a6273725564b7f647a6b8d88e0fec2646 Mon Sep 17 00:00:00 2001 From: Taylor R Campbell Date: Thu, 24 Sep 2009 12:33:54 -0400 Subject: [PATCH] Fix hygiene in top-level bindings of synthetic identifiers. Make such bindings globally unique by creating them with uninterned symbols, bypassing the alpha renaming which was making them look prettier at the expense of global uniqueness. --- src/runtime/syntax-output.scm | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/runtime/syntax-output.scm b/src/runtime/syntax-output.scm index 7ecbc3347..c3ba60013 100644 --- a/src/runtime/syntax-output.scm +++ b/src/runtime/syntax-output.scm @@ -424,7 +424,19 @@ USA. (define (rename-top-level-identifier identifier) (if (symbol? identifier) identifier - (rename-identifier identifier (delay 0)))) + ;; Generate an uninterned symbol here and now, rather than + ;; storing anything in the rename database, because we are + ;; creating a top-level binding for a synthetic name, which must + ;; be globally unique. Using the rename database causes the + ;; substitution logic above to try to use an interned symbol + ;; with a nicer name. The decorations on this name are just + ;; that -- decorations, for human legibility. It is the use of + ;; an uninterned symbol that guarantees uniqueness. + (utf8-string->uninterned-symbol + (string-append "." + (symbol-name (identifier->symbol identifier)) + "." + (number->string (force (make-rename-id))))))) (define (make-name-generator) (let ((id (make-rename-id))) -- 2.25.1