From 607d427f81468f3401810f0cd5a0057dc36aa2c7 Mon Sep 17 00:00:00 2001 From: Andy Wingo Date: Wed, 28 Aug 2019 10:28:44 +0200 Subject: [PATCH] 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 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 ...))