unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
From: Ian Hulin <ian@hulin.org.uk>
To: guile-devel@gnu.org
Cc: lilypond-devel@gnu.org
Subject: Re: %module-public-interface
Date: Sat, 15 May 2010 21:32:41 +0100	[thread overview]
Message-ID: <4BEF04E9.4060301@hulin.org.uk> (raw)
In-Reply-To: <m3eii063ed.fsf@pobox.com>

Hi Andy,

On 27/04/10 21:34, Andy Wingo wrote:
> Hi Ian,
>
> On Fri 02 Apr 2010 02:11, Ian Hulin<ian@hulin.org.uk>  writes:
>
>> On 30/03/10 22:52, Ludovic � wrote:
>>>
>>> Lilypond does:
>>>
>>> --8<---------------cut here---------------start------------->8---
>>>         mod = scm_call_0 (maker);
>>>         scm_module_define (mod, ly_symbol2scm ("%module-public-interface"),
>>>                            mod);
>>> --8<---------------cut here---------------end--------------->8---
>>>
>>> Solution: do something like:
>>>
>>> --8<---------------cut here---------------start------------->8---
>>> #ifdef HAVE_SCM_SET_MODULE_PUBLIC_INTERFACE_X
>>>     scm_set_module_public_interface_x (mod, mod);
>>> #else
>>>     scm_module_define (mod, ly_symbol2scm ("%module-public-interface"),
>>>                        mod);
>>> #endif
>>> --8<---------------cut here---------------end--------------->8---
>>>
>>> (We just need to add that function.)
>
> As it appears here that you are trying to export everything from that
> module (in a somewhat incorrect formulation -- I can explain if you
> like), and that seems to be a sort of pattern, I'd suggest that instead
> we offer a module-export-all! function. Here is some code to provide
> such a function for pre-2.0 guile:
>
>      (cond-expand
>        ((not guile-2)
>         (define (module-export-all! mod)
>           (define (fresh-interface!)
>             (let ((iface (make-module)))
>               (set-module-name! iface (module-name mod))
>               ;; for guile 2: (set-module-version! iface (module-version mod))
>               (set-module-kind! iface 'interface)
>               (set-module-public-interface! mod iface)
>               iface))
>           (let ((iface (or (module-public-interface mod)
>                            (fresh-interface!))))
>             (set-module-obarray! iface (module-obarray mod))))))
>
> Use that to export all bindings instead. As it is, there are some shims
> for %module-public-interface hackery to keep on working if deprecated
> code is compiled in, but you should migrate to calling
> module-export-all!, I think.
>
> Then your C code would unconditionally:
>
>     scm_call_1 (scm_variable_ref (module_export_all_var), mod);
>
> Regards,
>
> Andy

Lilypond currently has a patch submitted to use your suggested guile 
code to avoid using the reference to %module-public-interface in 
Lilypond C++ code.

Please can you confirm that module-export-all! will be supplied in Guile 
V2.0.

Cheers,
Ian Hulin





  reply	other threads:[~2010-05-15 20:32 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-30 20:45 %module-public-interface Andy Wingo
2010-03-30 20:56 ` %module-public-interface Ludovic Courtès
2010-03-30 21:07   ` %module-public-interface Andy Wingo
2010-03-30 21:52     ` %module-public-interface Ludovic Courtès
2010-03-30 22:20       ` %module-public-interface Andy Wingo
2010-04-02  0:11       ` %module-public-interface Ian Hulin
2010-04-02  9:37         ` %module-public-interface Ludovic Courtès
2010-04-02 11:58           ` %module-public-interface Ian Hulin
2010-04-02 18:50             ` %module-public-interface Patrick McCarty
2010-04-03  0:52               ` %module-public-interface Graham Percival
2010-04-06 14:00             ` %module-public-interface Han-Wen Nienhuys
2010-04-06 14:32               ` %module-public-interface Ludovic Courtès
2010-04-27 20:34         ` %module-public-interface Andy Wingo
2010-05-15 20:32           ` Ian Hulin [this message]
2010-05-21  9:48             ` %module-public-interface Andy Wingo
2010-03-31 20:42 ` Hierarchical name space Ludovic Courtès
2010-03-31 22:31   ` Andy Wingo
2010-04-07 22:42     ` Julian Graham
2010-04-07 23:01       ` Ludovic Courtès
2010-04-08  7:29         ` Andy Wingo
2010-04-08  8:39           ` Ludovic Courtès
  -- strict thread matches above, loose matches on Subject: below --
2020-01-15  6:50 %module-public-interface dsmich
2020-01-15 19:59 ` %module-public-interface Andy Wingo
2007-08-10 13:57 %module-public-interface Andy Wingo
2007-08-10 14:54 ` %module-public-interface Ludovic Courtès
2010-03-30 21:02   ` %module-public-interface Andy Wingo
2010-03-30 21:40     ` %module-public-interface Ludovic Courtès

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4BEF04E9.4060301@hulin.org.uk \
    --to=ian@hulin.org.uk \
    --cc=guile-devel@gnu.org \
    --cc=lilypond-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).