on second thought, PR 10185 demonstrates why the variant of dynamic-require (and namespace-attach-module) that doesn't make the phase availble is difficult to reason about; changing dynamic-require and namespace-attach-module, instead of DrScheme
svn: r14454
This commit is contained in:
parent
a472a4452c
commit
8c9bcd50c2
|
@ -234,11 +234,7 @@
|
|||
(parameterize ([current-namespace (current-namespace)])
|
||||
;; the prompt makes it continue after an error
|
||||
(call-with-continuation-prompt
|
||||
(λ ()
|
||||
;; instantiate compile time:
|
||||
(dynamic-require modspec (void))
|
||||
;; instantiate run time:
|
||||
(dynamic-require modspec #f))))
|
||||
(λ () (dynamic-require modspec #f))))
|
||||
(current-namespace (module->namespace modspec))
|
||||
(check-interactive-language))
|
||||
;; here's where they're all combined with the module expression
|
||||
|
|
|
@ -331,9 +331,10 @@ relative to @scheme[current-load-relative-directory] and/or
|
|||
@scheme[current-directory].
|
||||
|
||||
If @scheme[provided] is @scheme[#f], then the result is @|void-const|,
|
||||
and the module is not @tech{visit}ed (see @secref["mod-parse"]) or
|
||||
even made @tech{available} (for on-demand @tech{visits}) in phases
|
||||
above the @tech{base phase}.
|
||||
and the module is not @tech{visit}ed (see @secref["mod-parse"]) in
|
||||
phases above the @tech{base phase}, although it is made
|
||||
@tech{available} for on-demand @tech{visits}.
|
||||
|
||||
|
||||
When @scheme[provided] is a symbol, the value of the module's export
|
||||
with the given name is returned, and still the module is not
|
||||
|
|
|
@ -254,8 +254,8 @@ is used as the module name in @scheme[dest-namespace]. In addition to
|
|||
indirectly) is also recorded in the current namespace's @tech{module
|
||||
registry}, and instances at the same @tech{phase} or lower are also
|
||||
attached to @scheme[dest-namespace] (while @tech{visits} at the
|
||||
module's phase and instances at higher phases are not attached, nor
|
||||
even made @tech{available} for on-demand @tech{visits}). The inspector
|
||||
module's phase and instances at higher phases are not attached, although it is
|
||||
made @tech{available} for on-demand @tech{visits}). The inspector
|
||||
of the module invocation in @scheme[dest-namespace] is the same as
|
||||
inspector of the invocation in @scheme[src-namespace].
|
||||
|
||||
|
|
|
@ -124,6 +124,8 @@ static void eval_exptime(Scheme_Object *names, int count,
|
|||
|
||||
static Scheme_Module_Exports *make_module_exports();
|
||||
|
||||
XFORM_NONGCING static void should_run_for_compile(Scheme_Env *menv);
|
||||
|
||||
#define cons scheme_make_pair
|
||||
|
||||
|
||||
|
@ -891,7 +893,7 @@ static Scheme_Object *_dynamic_require(int argc, Scheme_Object *argv[],
|
|||
if (!phase) {
|
||||
/* Evaluate id in a fresh namespace */
|
||||
Scheme_Object *a[3], *ns;
|
||||
start_module(m, env, 0, modidx, 0, 1, base_phase, scheme_null);
|
||||
start_module(m, env, 0, modidx, -1, 1, base_phase, scheme_null);
|
||||
a[0] = scheme_intern_symbol("empty");
|
||||
ns = scheme_make_namespace(1, a);
|
||||
a[0] = (Scheme_Object *)env;
|
||||
|
@ -984,7 +986,7 @@ static Scheme_Object *_dynamic_require(int argc, Scheme_Object *argv[],
|
|||
if (SCHEME_VOIDP(name))
|
||||
start_module(m, env, 0, modidx, 1, 0, base_phase, scheme_null);
|
||||
else
|
||||
start_module(m, env, 0, modidx, 0, 1, base_phase, scheme_null);
|
||||
start_module(m, env, 0, modidx, -1, 1, base_phase, scheme_null);
|
||||
|
||||
if (SCHEME_SYMBOLP(name)) {
|
||||
Scheme_Bucket *b;
|
||||
|
@ -1688,6 +1690,9 @@ static Scheme_Object *namespace_attach_module(int argc, Scheme_Object *argv[])
|
|||
|
||||
check_phase(menv2, NULL, phase);
|
||||
scheme_hash_set(MODCHAIN_TABLE(to_modchain), name, (Scheme_Object *)menv2);
|
||||
if (menv2->phase > orig_phase) {
|
||||
should_run_for_compile(menv2);
|
||||
}
|
||||
}
|
||||
scheme_hash_set(to_env->module_registry, name, (Scheme_Object *)menv->module);
|
||||
scheme_hash_set(to_env->export_registry, name, (Scheme_Object *)menv->module->me);
|
||||
|
@ -3981,7 +3986,7 @@ static void do_start_module(Scheme_Module *m, Scheme_Env *menv, Scheme_Env *env,
|
|||
}
|
||||
}
|
||||
|
||||
static void should_run_for_compile(Scheme_Env *menv)
|
||||
XFORM_NONGCING static void should_run_for_compile(Scheme_Env *menv)
|
||||
{
|
||||
if (!menv->available_next[0]) {
|
||||
menv->available_next[0] = MODCHAIN_AVAIL(menv->modchain, 0);
|
||||
|
@ -4687,7 +4692,9 @@ module_execute(Scheme_Object *data)
|
|||
|
||||
/* Replacing an already-running or already-syntaxing module? */
|
||||
if (old_menv) {
|
||||
start_module(m, env, 1, NULL, 0, (old_menv->running > 0) ? 1 : 0, env->phase, scheme_null);
|
||||
start_module(m, env, 1, NULL,
|
||||
(old_menv->et_running ? 1 : 0), (old_menv->running > 0) ? 1 : 0,
|
||||
env->phase, scheme_null);
|
||||
}
|
||||
|
||||
return scheme_void;
|
||||
|
|
Loading…
Reference in New Issue
Block a user