Fix hygiene in top-level bindings of synthetic identifiers.
authorTaylor R Campbell <campbell@mumble.net>
Thu, 24 Sep 2009 16:33:54 +0000 (12:33 -0400)
committerTaylor R Campbell <campbell@mumble.net>
Thu, 24 Sep 2009 16:33:54 +0000 (12:33 -0400)
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

index 7ecbc334738e299cf306bca7c2646c0cbd87d402..c3ba6001316ac4de8d8683ec625e3b37d68381ee 100644 (file)
@@ -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)))