diff options
author | Ludovic Courtès <ludo@gnu.org> | 2009-08-14 19:30:14 +0200 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2009-09-20 21:54:41 +0200 |
commit | 87c595c757b7db84ffdcfda96f736ab235e674a8 (patch) | |
tree | a056f78b6684c3e5b3829ade38972f8ea9cf6f3f /libguile/load.c | |
parent | f5a51caec1bf1900b269da6e07fe466199372970 (diff) | |
download | guile-87c595c757b7db84ffdcfda96f736ab235e674a8.tar.gz |
Compile in a fresh module by default.
* module/system/base/compile.scm (make-compilation-module,
language-default-environment): New procedures.
(read-and-compile, compile): Have ENV default to
`(language-default-environment from)'.
(compile-and-load): Compile in `(current-module)'.
* module/system/repl/common.scm (repl-compile): Explicitly compile in
the current module so that macro definitions are visible.
* libguile/load.c (kw_env): New variable.
(do_try_autocompile): Call `compile-file' with `#:env (current-module)'.
* test-suite/tests/compiler.test ("psyntax")["compile uses a fresh module by
default", "compile-time definitions are isolated"]: New tests.
["compile in current module"]: Specify `#:env (current-module)'.
["redefinition"]: Adjust.
* test-suite/tests/bytevectors.test (c&e): Explicitly compile in the
current module so that its imports are visible.
Diffstat (limited to 'libguile/load.c')
-rw-r--r-- | libguile/load.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/libguile/load.c b/libguile/load.c index 246cf8977..10cbdb255 100644 --- a/libguile/load.c +++ b/libguile/load.c @@ -601,6 +601,8 @@ compiled_is_fresh (SCM full_filename, SCM compiled_filename) return res; } +SCM_KEYWORD (kw_env, "env"); + static SCM do_try_autocompile (void *data) { @@ -617,7 +619,9 @@ do_try_autocompile (void *data) if (scm_is_true (compile_file)) { - SCM res = scm_call_1 (scm_variable_ref (compile_file), source); + /* Auto-compile in the context of the current module. */ + SCM res = scm_call_3 (scm_variable_ref (compile_file), source, + kw_env, scm_current_module ()); scm_puts (";;; compiled ", scm_current_error_port ()); scm_display (res, scm_current_error_port ()); scm_newline (scm_current_error_port ()); |