[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Guile-commits] 02/03: Emit warning when using "load" in declarative mod
From: |
Andy Wingo |
Subject: |
[Guile-commits] 02/03: Emit warning when using "load" in declarative modules |
Date: |
Wed, 28 Aug 2019 04:49:07 -0400 (EDT) |
wingo pushed a commit to branch master
in repository guile.
commit 607d427f81468f3401810f0cd5a0057dc36aa2c7
Author: Andy Wingo <address@hidden>
Date: Wed Aug 28 10:28:44 2019 +0200
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.
---
module/ice-9/boot-9.scm | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/module/ice-9/boot-9.scm b/module/ice-9/boot-9.scm
index d6dd50d..062ab68 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 ...))