mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-10 14:00:21 +02:00
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.
This commit is contained in:
parent
a2f5f9eda4
commit
607d427f81
1 changed files with 7 additions and 0 deletions
|
@ -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 ...))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue