[frogs] Re: T1055: Avoid using deprecated %module-public-interface in guile initialisation. (issue1160044)

[ Thread Index | Date Index | More lilynet.net/frogs Archives ]


On Thu, Jul 15, 2010 at 4:30 PM, Ian Hulin <ian@xxxxxxxxxxxx> wrote:
>
> I've been having a look at this, and I need a bit more info, Han-Wenn, on
> why the C++ code uses the %module-public-interface the way it does
>
> SCM mod = SCM_EOL;
>   if (!safe)
>     {
>       SCM maker = ly_lily_module_constant ("make-module");
>
>       SCM scm_module = ly_lily_module_constant ("the-scm-module");
>
>       mod = scm_call_0 (maker);
>       scm_module_define (mod, ly_symbol2scm ("%module-public-interface"),
>              mod);
>
>       ly_use_module (mod, scm_module);
>       ly_use_module (mod, global_lily_module);
>     }
>   else
>     {
> // snip . . .
>     }
>
> Which is sort of like doing this in Scheme:
> (define mod (make-module))
> (define curmod '())
> (define scm_module (resolve-module '(the-scm-module)))
> (define global-lily-module '(lily))
> (module-define! mod %module-public-interface mod)
> (set! curmod (set-current-module mod))
> (use-modules (scm-module global-lily-module))
> (set-current-module curmod)
>
> (please excuse the bad Scheme).
>
> Also, ly_use_module does:
> SCM
> ly_use_module (SCM mod, SCM used)
> {
>   SCM expr
>     = scm_list_3 (ly_symbol2scm ("module-use!"),
>           mod,
>           scm_list_2 (ly_symbol2scm ("module-public-interface"),
> /*                                                    ^no %
> here                 */
>                   used));
>
>   return scm_eval (expr, global_lily_module);
> }
>
> Han-Wenn, What's the difference between the two ly_symbol2scm calls?

Hi Ian,

I'm glad you noticed that part from ly_use_module().  Whatever the
"module-public-interface" binding (without the %) was used for, it
seems to prevent modules from loading correctly.

Can you test the attached patch (with Guile 1.9) to see if it works
for you?  I haven't tested this with Guile 1.8 yet.

Thanks,
Patrick
diff --git a/lily/ly-module.cc b/lily/ly-module.cc
index 42ff2f8..02339be 100644
--- a/lily/ly-module.cc
+++ b/lily/ly-module.cc
@@ -55,10 +55,7 @@ SCM
 ly_use_module (SCM mod, SCM used)
 {
   SCM expr
-    = scm_list_3 (ly_symbol2scm ("module-use!"),
-		  mod,
-		  scm_list_2 (ly_symbol2scm ("module-public-interface"),
-			      used));
+    = scm_list_3 (ly_symbol2scm ("module-use!"), mod, used);
 
   return scm_eval (expr, global_lily_module);
 }


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/