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

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


On 19/05/10 23:42, n.puttock@xxxxxxxxx wrote:
Hi Ian,

I've tried testing your latest patch, but it fails on clip-systems.ly.

`make-rhythmic-location' (defined in clip-region.scm) appears to be
inaccessible from a \layout block.

Cheers,
Neil

http://www.codereview.appspot.com/1160044/show

______________________________________________       This email has been scanned by Netintelligence       http://www.netintelligence.com/email


Hi all,

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?

This is from a discussion on Lily's use of %module-public-interface on guile-devel

"
Actually the trick wouldn’t work in cases where the ‘%module-public-interface’ binding is mutated, as with Lilypond."
 
Ludovic, what did you mean by this?  Please explain in terms a scheme-coding simpleton (i.e. me) would understand.  Why is what the Lilypond code is doing such A Bad Thing as far as guile is concerned?   How could we re-code to achieve the same results in a way that guile supports?  It looks like one of Lilypond's regression tests really depends on this and the replacement scheme code Andy Wingo gave us (module-export-all!) doesn't emulate this behaviour well enough to pass the Lilypond regression test.

I'm a part-time developer and I feel I'm in way over my head on this now.

If anyone can throw a life-raft to me on this one before I sink for the third time in the sea of incomprehension it would be appreciated.

Glug, glug,  glug . . .

Cheers,

Ian

 

 


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