If a synthetic identifier is bound at top level, rename it to a
authorChris Hanson <org/chris-hanson/cph>
Fri, 22 Feb 2002 01:35:12 +0000 (01:35 +0000)
committerChris Hanson <org/chris-hanson/cph>
Fri, 22 Feb 2002 01:35:12 +0000 (01:35 +0000)
special name so that it doesn't conflict with other non-EQ?
identifiers.

v7/src/runtime/syntactic-closures.scm

index 2933550eb81bb14a66b18e7f073540d492fc1f03..c9c77cb26486a0cc8f51ec8e4668d0313a4b4415 100644 (file)
@@ -1,6 +1,6 @@
 ;;; -*-Scheme-*-
 ;;;
-;;; $Id: syntactic-closures.scm,v 14.6 2002/02/19 21:28:20 cph Exp $
+;;; $Id: syntactic-closures.scm,v 14.7 2002/02/22 01:35:12 cph Exp $
 ;;;
 ;;; Copyright (c) 1989-1991, 2001, 2002 Massachusetts Institute of Technology
 ;;;
 
 (define (environment/rename environment name)
   environment
-  (identifier->symbol name))
+  (rename-top-level-identifier name))
 \f
 ;;; Top-level syntactic environments represent top-level environments.
 ;;; They are always layered over a real syntactic environment.
 
 (define (top-level-syntactic-environment/rename environment name)
   environment
-  (identifier->symbol name))
+  (rename-top-level-identifier name))
 
 (define (top-level-syntactic-environment->environment environment)
   (syntactic-environment->environment
     (lambda (identifier)
       (rename-identifier identifier state))))
 
+(define (rename-top-level-identifier identifier)
+  (if (symbol? identifier)
+      identifier
+      (intern
+       (string-append "."
+                     (symbol->string (identifier->symbol identifier))
+                     "."
+                     (number->string (hash identifier))
+                     "-0"))))
+
 (define (reverse-syntactic-environments environment procedure)
   (capture-syntactic-environment
    (lambda (closing-environment)