The V2.17.0 definition of ly_module_lookup in module-scheme.cc uses two
functions, scm_sym2var and scm_module_lookup_closure, which issue
deprecation warnings in Guile V2.06. A call to the new Guile API function,
scm_module_variable, provides the functionality for both deprecated
routines, but has not been back-ported to Guile V1.8.
This patch adds a conditionally-compiled block when running with a Guile
version < V2.0, so that Guile V1 will the existing undocumented API calls
in ly_module_lookup, but Guile V2 will use API call scm_module_variable.
/*
Issue 2758:
Guile V2 onward has a scm_module_variable API module.
- Guile V1.8.7 only has a (module-variable) REPL function.
- Replace previous code using undocumented API calls deprecated
- in Guile V2.
+ Guile V1.8.7 only has a (module-variable) REPL function, however
+ using ly_lily_module_constant ("module-variable") and calling
+ the memoized result is slow.
*/
#if GUILEV1
- static SCM module_variable_func = ly_lily_module_constant ("module-variable");
- return scm_call_2 (module_variable_func, module, sym);
+ return scm_sym2var (sym, scm_module_lookup_closure (module), SCM_BOOL_F);
#else
return scm_module_variable (module, sym);
#endif