From 595148fd88809b16be125481db7d133057af5b94 Mon Sep 17 00:00:00 2001 From: Chris Hanson Date: Wed, 11 Feb 1998 05:16:46 +0000 Subject: [PATCH] Undo previous change, but add global variable *ALLOW-PACKAGE-REDEFINITION?* that, if true, allows packages to be redefined. Intent is that this variable will be fluid-bound by programs that want to be reloadable. --- v7/src/runtime/make.scm | 7 ++++--- v7/src/runtime/packag.scm | 16 ++++++++++------ v7/src/runtime/runtime.pkg | 3 ++- v8/src/runtime/make.scm | 7 ++++--- v8/src/runtime/runtime.pkg | 3 ++- 5 files changed, 22 insertions(+), 14 deletions(-) diff --git a/v7/src/runtime/make.scm b/v7/src/runtime/make.scm index 95756db9f..a32e8e037 100644 --- a/v7/src/runtime/make.scm +++ b/v7/src/runtime/make.scm @@ -1,8 +1,8 @@ #| -*-Scheme-*- -$Id: make.scm,v 14.60 1997/07/13 07:24:46 cph Exp $ +$Id: make.scm,v 14.61 1998/02/11 05:16:46 cph Exp $ -Copyright (c) 1988-97 Massachusetts Institute of Technology +Copyright (c) 1988-98 Massachusetts Institute of Technology This material was developed by the Scheme project at the Massachusetts Institute of Technology, Department of Electrical Engineering and @@ -310,7 +310,8 @@ MIT in each case. |# (eval (file->object "packag" #t #f) environment-for-package) ((access initialize-package! environment-for-package)) (let loop ((names - '(ENVIRONMENT->PACKAGE + '(*ALLOW-PACKAGE-REDEFINITION?* + ENVIRONMENT->PACKAGE FIND-PACKAGE NAME->PACKAGE PACKAGE/ADD-CHILD! diff --git a/v7/src/runtime/packag.scm b/v7/src/runtime/packag.scm index 49b8c61d0..af671490d 100644 --- a/v7/src/runtime/packag.scm +++ b/v7/src/runtime/packag.scm @@ -1,6 +1,6 @@ #| -*-Scheme-*- -$Id: packag.scm,v 14.26 1998/02/11 04:50:31 cph Exp $ +$Id: packag.scm,v 14.27 1998/02/11 05:10:59 cph Exp $ Copyright (c) 1988-98 Massachusetts Institute of Technology @@ -134,7 +134,7 @@ MIT in each case. |# '() (cons (car list) (loop (cdr list)))))) -(define (package/add-child! package name environment #!optional no-force?) +(define (package/add-child! package name environment #!optional force?) (let ((child (package/child package name)) (finish (lambda (child) @@ -143,7 +143,9 @@ MIT in each case. |# child))) (if child (begin - (if (and (not (default-object? no-force?)) no-force?) + (if (not (if (default-object? force?) + *allow-package-redefinition?* + force?)) (error "Package already has child of given name:" package name)) (set-package/environment! child environment) (set-package/children! child '()) @@ -154,6 +156,7 @@ MIT in each case. |# (finish child))))) (define system-global-package) +(define *allow-package-redefinition?*) (define system-loader/enable-query? false) @@ -226,8 +229,9 @@ MIT in each case. |# (lexical-reference (package/environment package) name)) (define (initialize-package!) - (set! system-global-package - (make-package false false system-global-environment)) + (set! system-global-package (make-package #f #f system-global-environment)) (local-assignment system-global-environment package-name-tag - system-global-package)) \ No newline at end of file + system-global-package) + (set! *allow-package-redefinition?* #f) + unspecific) \ No newline at end of file diff --git a/v7/src/runtime/runtime.pkg b/v7/src/runtime/runtime.pkg index cf37f0d7e..3ba91b04d 100644 --- a/v7/src/runtime/runtime.pkg +++ b/v7/src/runtime/runtime.pkg @@ -1,6 +1,6 @@ #| -*-Scheme-*- -$Id: runtime.pkg,v 14.289 1998/01/08 05:59:11 cph Exp $ +$Id: runtime.pkg,v 14.290 1998/02/11 05:11:34 cph Exp $ Copyright (c) 1988-98 Massachusetts Institute of Technology @@ -65,6 +65,7 @@ MIT in each case. |# (files "packag") (parent ()) (export () + *allow-package-redefinition?* environment->package find-package name->package diff --git a/v8/src/runtime/make.scm b/v8/src/runtime/make.scm index defa854b7..7327f30cb 100644 --- a/v8/src/runtime/make.scm +++ b/v8/src/runtime/make.scm @@ -1,8 +1,8 @@ #| -*-Scheme-*- -$Id: make.scm,v 14.63 1997/07/10 09:25:06 adams Exp $ +$Id: make.scm,v 14.64 1998/02/11 05:16:33 cph Exp $ -Copyright (c) 1988-97 Massachusetts Institute of Technology +Copyright (c) 1988-98 Massachusetts Institute of Technology This material was developed by the Scheme project at the Massachusetts Institute of Technology, Department of Electrical Engineering and @@ -320,7 +320,8 @@ MIT in each case. |# (eval (file->object "packag" #t #f) environment-for-package) ((access initialize-package! environment-for-package)) (let loop ((names - '(ENVIRONMENT->PACKAGE + '(*ALLOW-PACKAGE-REDEFINITION?* + ENVIRONMENT->PACKAGE FIND-PACKAGE NAME->PACKAGE PACKAGE/ADD-CHILD! diff --git a/v8/src/runtime/runtime.pkg b/v8/src/runtime/runtime.pkg index 1efbce4a7..9f67adc67 100644 --- a/v8/src/runtime/runtime.pkg +++ b/v8/src/runtime/runtime.pkg @@ -1,6 +1,6 @@ #| -*-Scheme-*- -$Id: runtime.pkg,v 14.295 1998/01/08 05:59:01 cph Exp $ +$Id: runtime.pkg,v 14.296 1998/02/11 05:11:07 cph Exp $ Copyright (c) 1988-98 Massachusetts Institute of Technology @@ -65,6 +65,7 @@ MIT in each case. |# (files "packag") (parent ()) (export () + *allow-package-redefinition?* environment->package find-package name->package -- 2.25.1