summaryrefslogtreecommitdiff
path: root/module/ice-9/boot-9.scm
diff options
context:
space:
mode:
authorAndy Wingo <wingo@pobox.com>2019-08-28 10:28:44 +0200
committerAndy Wingo <wingo@pobox.com>2019-08-28 10:44:44 +0200
commit607d427f81468f3401810f0cd5a0057dc36aa2c7 (patch)
treeba57f97c988d10d7f1c5347affffb9eb7b735890 /module/ice-9/boot-9.scm
parenta2f5f9eda4949c62c5a01e0da71605343be3df60 (diff)
downloadguile-607d427f81468f3401810f0cd5a0057dc36aa2c7.tar.gz
Emit warning when using "load" in declarative modules
* module/ice-9/boot-9.scm (load): Emit a warning at compile-time when using "load" from a declarative module.
Diffstat (limited to 'module/ice-9/boot-9.scm')
-rw-r--r--module/ice-9/boot-9.scm7
1 files changed, 7 insertions, 0 deletions
diff --git a/module/ice-9/boot-9.scm b/module/ice-9/boot-9.scm
index d6dd50d13..062ab688e 100644
--- a/module/ice-9/boot-9.scm
+++ b/module/ice-9/boot-9.scm
@@ -3847,6 +3847,13 @@ when none is available, reading FILE-NAME with READER."
(let* ((src (syntax-source x))
(file (and src (assq-ref src 'filename)))
(dir (and (string? file) (dirname file))))
+ ;; A module that uses `load' is not declarative.
+ (when (module-declarative? (current-module))
+ (format (current-warning-port)
+ "WARNING: Use of `load' in declarative module ~A. ~A\n"
+ (module-name (current-module))
+ "Add #:declarative? #f to your define-module invocation.")
+ (set-module-declarative?! (current-module) #f))
(syntax-case x ()
((_ arg ...)
#`(load-in-vicinity #,(or dir #'(getcwd)) arg ...))