guile-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

guile/guile-core/ice-9 boot-9.scm


From: Marius Vollmer
Subject: guile/guile-core/ice-9 boot-9.scm
Date: Sat, 02 Jun 2001 11:33:25 -0700

CVSROOT:        /cvs
Module name:    guile
Changes by:     Marius Vollmer <address@hidden> 01/06/02 11:33:25

Modified files:
        guile-core/ice-9: boot-9.scm 

Log message:
        (module-ensure-variable!): New.
        (module-export!): Use it to ensure that there is a variable to
        export.  Previously, we would always create a new variable, copy
        the value over, and export the new variable.  This confused
        syncase since it keys important properties on variables.

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/guile/guile-core/ice-9/boot-9.scm.diff?cvsroot=OldCVS&tr1=1.256&tr2=1.257&r1=text&r2=text

Patches:
Index: guile/guile-core/ice-9/boot-9.scm
diff -u guile/guile-core/ice-9/boot-9.scm:1.256 
guile/guile-core/ice-9/boot-9.scm:1.257
--- guile/guile-core/ice-9/boot-9.scm:1.256     Fri Jun  1 13:15:10 2001
+++ guile/guile-core/ice-9/boot-9.scm   Sat Jun  2 11:33:25 2001
@@ -1256,6 +1256,19 @@
          (module-modified m)
          answer))))
 
+;; module-ensure-variable! module symbol
+;;
+;; ensure that there is a variable in MODULE for SYMBOL.  If there is
+;; no binding for SYMBOL, create a new undefined variable.  Return
+;; that variable.
+;;
+(define (module-ensure-variable! module symbol)
+  (or (module-variable module symbol)
+      (let ((var (make-undefined-variable)))
+       (variable-set-name-hint! var symbol)
+       (module-add! module symbol var)
+       var)))
+
 ;; module-add! module symbol var
 ;;
 ;; ensure a particular variable for V in the local namespace of M.
@@ -2745,10 +2758,8 @@
 (define (module-export! m names)
   (let ((public-i (module-public-interface m)))
     (for-each (lambda (name)
-               ;; Make sure there is a local variable:
-               (module-define! m name (module-ref m name #f))
-               ;; Make sure that local is exported:
-               (module-add! public-i name (module-variable m name)))
+               (let ((var (module-ensure-variable! m name)))
+                 (module-add! public-i name var)))
              names)))
 
 (defmacro export names



reply via email to

[Prev in Thread] Current Thread [Next in Thread]