unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
* %module-public-interface
@ 2007-08-10 13:57 Andy Wingo
  2007-08-10 14:54 ` %module-public-interface Ludovic Courtès
  0 siblings, 1 reply; 21+ messages in thread
From: Andy Wingo @ 2007-08-10 13:57 UTC (permalink / raw)
  To: guile-devel

Hello all,

Currently the public interface of a module is bound to a symbol in the
module, %module-public-interface. This is a bit silly, as modules are
record types anyway; why not just add another field in the module struct
for this kind of metadata? Suggest doing so in 1.9.

Regards,

Andy.
-- 
http://wingolog.org/


_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-devel


^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: %module-public-interface
  2007-08-10 13:57 %module-public-interface Andy Wingo
@ 2007-08-10 14:54 ` Ludovic Courtès
  2010-03-30 21:02   ` %module-public-interface Andy Wingo
  0 siblings, 1 reply; 21+ messages in thread
From: Ludovic Courtès @ 2007-08-10 14:54 UTC (permalink / raw)
  To: guile-devel

Hey!

Andy Wingo <wingo@pobox.com> writes:

> Currently the public interface of a module is bound to a symbol in the
> module, %module-public-interface. This is a bit silly, as modules are
> record types anyway; why not just add another field in the module struct
> for this kind of metadata? Suggest doing so in 1.9.

Agreed.

Thanks,
Ludovic.



_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-devel


^ permalink raw reply	[flat|nested] 21+ messages in thread

* %module-public-interface
@ 2010-03-30 20:45 Andy Wingo
  2010-03-30 20:56 ` %module-public-interface Ludovic Courtès
  0 siblings, 1 reply; 21+ messages in thread
From: Andy Wingo @ 2010-03-30 20:45 UTC (permalink / raw)
  To: guile-devel

Hello,

As you might well know, in every module that actually has a public
interface (most all of them), there is an extra symbol bound in that
module: %module-public-interface. It references, um, the public
interface.

Also in every module that has submodules, like (language tree-il) and
(language tree-il compile-glil), the "supermodule" has a binding for the
submodule. Do a (module-ref (resolve-module '(ice-9)) 'threads)
sometime.

It is, as my southern-US family would say, "turrible". But somehow it
normally doesn't affect us.

I'm pretty sure that the submodule thing can be changed without any
problem. But it seems that the %module-public-interface is used
explicitly, at least by texmacs and lilypond.

Any ideas on what the right thing to do is? Just leave it? Add fields to
modules for the public interface and submodules, but keep the
%module-public-interface binding? Throw up our hands and dance around?

Let me know,

Andy
-- 
http://wingolog.org/




^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: %module-public-interface
  2010-03-30 20:45 %module-public-interface Andy Wingo
@ 2010-03-30 20:56 ` Ludovic Courtès
  2010-03-30 21:07   ` %module-public-interface Andy Wingo
  0 siblings, 1 reply; 21+ messages in thread
From: Ludovic Courtès @ 2010-03-30 20:56 UTC (permalink / raw)
  To: guile-devel

Howdy!

Andy Wingo <wingo@pobox.com> writes:

> Do a (module-ref (resolve-module '(ice-9)) 'threads)
> sometime.

That’s the hierarchical naming scheme, not related to
%module-public-interface but probably worth a discussion.

> I'm pretty sure that the submodule thing can be changed without any
> problem. But it seems that the %module-public-interface is used
> explicitly, at least by texmacs and lilypond.

How do they use it?

> Any ideas on what the right thing to do is? Just leave it? Add fields to
> modules for the public interface and submodules, but keep the
> %module-public-interface binding? Throw up our hands and dance around?

Yeah!

And we could add a ‘public-interface’ slot to ‘module-type’ and have
‘module-public-interface’ and ‘set-module-public-interface!’ refer to
it; for backward compatibility we’d also initialize the
‘%module-public-interface’ binding.  How does it sound?

Thanks,
Ludo’.





^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: %module-public-interface
  2007-08-10 14:54 ` %module-public-interface Ludovic Courtès
@ 2010-03-30 21:02   ` Andy Wingo
  2010-03-30 21:40     ` %module-public-interface Ludovic Courtès
  0 siblings, 1 reply; 21+ messages in thread
From: Andy Wingo @ 2010-03-30 21:02 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guile-devel

FWIW, amusingly threaded against a mail I sent 2.5 years ago:

On Fri 10 Aug 2007 16:54, ludo@gnu.org (Ludovic Courtès) writes:

> Hey!
>
> Andy Wingo <wingo@pobox.com> writes:
>
>> Currently the public interface of a module is bound to a symbol in the
>> module, %module-public-interface. This is a bit silly, as modules are
>> record types anyway; why not just add another field in the module struct
>> for this kind of metadata? Suggest doing so in 1.9.
>
> Agreed.
>
> Thanks,
> Ludovic.

:)
-- 
http://wingolog.org/




^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: %module-public-interface
  2010-03-30 20:56 ` %module-public-interface Ludovic Courtès
@ 2010-03-30 21:07   ` Andy Wingo
  2010-03-30 21:52     ` %module-public-interface Ludovic Courtès
  0 siblings, 1 reply; 21+ messages in thread
From: Andy Wingo @ 2010-03-30 21:07 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guile-devel

On Tue 30 Mar 2010 22:56, ludo@gnu.org (Ludovic Courtès) writes:

>> I'm pretty sure that the submodule thing can be changed without any
>> problem. But it seems that the %module-public-interface is used
>> explicitly, at least by texmacs and lilypond.
>
> How do they use it?

Linking to the evil empire:

http://www.google.com/codesearch?hl=en&lr=&q=%25module-public-interface&sbtn=Search
http://www.google.com/codesearch?hl=en&lr=&q=%25module-public-interface+lang%3Ac%2B%2B&sbtn=Search

>> Any ideas on what the right thing to do is? Just leave it? Add fields to
>> modules for the public interface and submodules, but keep the
>> %module-public-interface binding? Throw up our hands and dance around?
>
> Yeah!
>
> And we could add a ‘public-interface’ slot to ‘module-type’ and have
> ‘module-public-interface’ and ‘set-module-public-interface!’ refer to
> it; for backward compatibility we’d also initialize the
> ‘%module-public-interface’ binding.  How does it sound?

Dancing? OK!

Also back compatibility. Er, yeah :)

Andy
-- 
http://wingolog.org/




^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: %module-public-interface
  2010-03-30 21:02   ` %module-public-interface Andy Wingo
@ 2010-03-30 21:40     ` Ludovic Courtès
  0 siblings, 0 replies; 21+ messages in thread
From: Ludovic Courtès @ 2010-03-30 21:40 UTC (permalink / raw)
  To: guile-devel

Andy Wingo <wingo@pobox.com> writes:

> FWIW, amusingly threaded against a mail I sent 2.5 years ago:

Yeah, well, I was assuming people didn’t do such nasty things as
Lilypond does.  :-)

Ludo’.





^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: %module-public-interface
  2010-03-30 21:07   ` %module-public-interface Andy Wingo
@ 2010-03-30 21:52     ` Ludovic Courtès
  2010-03-30 22:20       ` %module-public-interface Andy Wingo
  2010-04-02  0:11       ` %module-public-interface Ian Hulin
  0 siblings, 2 replies; 21+ messages in thread
From: Ludovic Courtès @ 2010-03-30 21:52 UTC (permalink / raw)
  To: guile-devel

Hello,

Andy Wingo <wingo@pobox.com> writes:

> On Tue 30 Mar 2010 22:56, ludo@gnu.org (Ludovic Courtès) writes:
>
>>> I'm pretty sure that the submodule thing can be changed without any
>>> problem. But it seems that the %module-public-interface is used
>>> explicitly, at least by texmacs and lilypond.
>>
>> How do they use it?
>
> Linking to the evil empire:
>
> http://www.google.com/codesearch?hl=en&lr=&q=%25module-public-interface&sbtn=Search
> http://www.google.com/codesearch?hl=en&lr=&q=%25module-public-interface+lang%3Ac%2B%2B&sbtn=Search

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.)

TeXmacs does:

--8<---------------cut here---------------start------------->8---
    (let* ((m (resolve-module which))
           (m-public (module-ref m '%module-public-interface)))
      (module-map (lambda (sym var) sym) m-public)))
--8<---------------cut here---------------end--------------->8---

and:

--8<---------------cut here---------------start------------->8---
           (let* ((m (resolve-module ',module))
                  (p (module-ref texmacs-user '%module-public-interface))
                  (r (module-ref p ',name #f)))
             (if (not r)
                 (texmacs-error "lazy-define"
                                ,(string-append "Could not retrieve "
                                                (symbol->string name))))
             (apply r args))))))
--8<---------------cut here---------------end--------------->8---

Solution: use ‘resolve-interface’.

Gossip does:

--8<---------------cut here---------------start------------->8---
        (append! (delq! '%module-public-interface
                        (module-map (lambda (sym var) sym) mod))
                 (hash-fold (lambda (k v r) (cons k r)) '() blocks)))
--8<---------------cut here---------------end--------------->8---

This snippet won’t see any difference.

>> And we could add a ‘public-interface’ slot to ‘module-type’ and have
>> ‘module-public-interface’ and ‘set-module-public-interface!’ refer to
>> it; for backward compatibility we’d also initialize the
>> ‘%module-public-interface’ binding.  How does it sound?

Actually the trick wouldn’t work in cases where the
‘%module-public-interface’ binding is mutated, as with Lilypond.

Given this and the above examples, I’d suggest dropping that binding
completely and sending patches to the Lilypond/TeXmacs people.

What do you think?

Thanks,
Ludo’.





^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: %module-public-interface
  2010-03-30 21:52     ` %module-public-interface Ludovic Courtès
@ 2010-03-30 22:20       ` Andy Wingo
  2010-04-02  0:11       ` %module-public-interface Ian Hulin
  1 sibling, 0 replies; 21+ messages in thread
From: Andy Wingo @ 2010-03-30 22:20 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guile-devel

On Tue 30 Mar 2010 23:52, ludo@gnu.org (Ludovic Courtès) writes:

>>> And we could add a ‘public-interface’ slot to ‘module-type’ and have
>>> ‘module-public-interface’ and ‘set-module-public-interface!’ refer to
>>> it; for backward compatibility we’d also initialize the
>>> ‘%module-public-interface’ binding.  How does it sound?
>
> Actually the trick wouldn’t work in cases where the
> ‘%module-public-interface’ binding is mutated, as with Lilypond.
>
> Given this and the above examples, I’d suggest dropping that binding
> completely and sending patches to the Lilypond/TeXmacs people.

Hm. I guess you're right.

In the case with deprecated foo enabled, we can add a
%module-public-interface definition in the root module, which maps to a
module with a binder procedure that will raise an error. That way we can
catch apps that we don't know about.

Andy
-- 
http://wingolog.org/




^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: %module-public-interface
  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       ` Ian Hulin
  2010-04-02  9:37         ` %module-public-interface Ludovic Courtès
  2010-04-27 20:34         ` %module-public-interface Andy Wingo
  1 sibling, 2 replies; 21+ messages in thread
From: Ian Hulin @ 2010-04-02  0:11 UTC (permalink / raw)
  To: guile-devel; +Cc: lilypond-devel@gnu.org, guile-devel

Hi Ludovic,

On 30/03/10 22:52, Ludovic � wrote:
> Hello,
>
> Andy Wingo<wingo@pobox.com>  writes:
>
>> On Tue 30 Mar 2010 22:56, ludo@gnu.org (Ludovic Courtès) writes:
>>
>>>> I'm pretty sure that the submodule thing can be changed without any
>>>> problem. But it seems that the %module-public-interface is used
>>>> explicitly, at least by texmacs and lilypond.
>>>
>>> How do they use it?
>>
>> Linking to the evil empire:
>>
>> http://www.google.com/codesearch?hl=en&lr=&q=%25module-public-interface&sbtn=Search
>> http://www.google.com/codesearch?hl=en&lr=&q=%25module-public-interface+lang%3Ac%2B%2B&sbtn=Search
>
> 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.)
>

> TeXmacs does:
<snip>
>>> And we could add a ‘public-interface’ slot to ‘module-type’ and have
>>> ‘module-public-interface’ and ‘set-module-public-interface!’ refer to
>>> it; for backward compatibility we’d also initialize the
>>> ‘%module-public-interface’ binding.  How does it sound?
>
> Actually the trick wouldn’t work in cases where the
> ‘%module-public-interface’ binding is mutated, as with Lilypond.
>
> Given this and the above examples, I’d suggest dropping that binding
> completely and sending patches to the Lilypond/TeXmacs people.
>
 > What do you think?

If you do add scm_set_module_public_interface_x, could you back-port it 
to Guile V1.8.6 and V1.8.7?

Those are the lowest versions of Guile the upcoming stable release of 
Lilypond will support.

Cheers,

Ian Hulin





^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: %module-public-interface
  2010-04-02  0:11       ` %module-public-interface Ian Hulin
@ 2010-04-02  9:37         ` Ludovic Courtès
  2010-04-02 11:58           ` %module-public-interface Ian Hulin
  2010-04-27 20:34         ` %module-public-interface Andy Wingo
  1 sibling, 1 reply; 21+ messages in thread
From: Ludovic Courtès @ 2010-04-02  9:37 UTC (permalink / raw)
  To: Ian Hulin; +Cc: lilypond-devel@gnu.org, guile-devel

Hi Ian,

Ian Hulin <ian@hulin.org.uk> writes:

> On 30/03/10 22:52, Ludovic � wrote:

>> Andy Wingo<wingo@pobox.com>  writes:
>>
>>> On Tue 30 Mar 2010 22:56, ludo@gnu.org (Ludovic Courtès) writes:
>>>
>>>>> I'm pretty sure that the submodule thing can be changed without any
>>>>> problem. But it seems that the %module-public-interface is used
>>>>> explicitly, at least by texmacs and lilypond.
>>>>
>>>> How do they use it?
>>>
>>> Linking to the evil empire:
>>>
>>> http://www.google.com/codesearch?hl=en&lr=&q=%25module-public-interface&sbtn=Search
>>> http://www.google.com/codesearch?hl=en&lr=&q=%25module-public-interface+lang%3Ac%2B%2B&sbtn=Search
>>
>> 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.)
>>
>
>> TeXmacs does:
> <snip>
>>>> And we could add a ‘public-interface’ slot to ‘module-type’ and have
>>>> ‘module-public-interface’ and ‘set-module-public-interface!’ refer to
>>>> it; for backward compatibility we’d also initialize the
>>>> ‘%module-public-interface’ binding.  How does it sound?
>>
>> Actually the trick wouldn’t work in cases where the
>> ‘%module-public-interface’ binding is mutated, as with Lilypond.
>>
>> Given this and the above examples, I’d suggest dropping that binding
>> completely and sending patches to the Lilypond/TeXmacs people.
>>
>> What do you think?
>
> If you do add scm_set_module_public_interface_x, could you back-port
> it to Guile V1.8.6 and V1.8.7?

We could back-port it to the 1.8 series, but not to the already-released
1.8.7 and 1.8.6.  We’d have to make a 1.8.8 release, but I’m not sure
that would really help anyway since that would force Lilypond users to
switch to that version.

> Those are the lowest versions of Guile the upcoming stable release of
> Lilypond will support.

How about doing #ifdef HAVE_SCM_SET_MODULE_PUBLIC_INTERFACE_X in your
code?

We still have to agree on the change and actually implement it, the
latter being easy. ;-)  When is the new Lilypond release due?

Thanks,
Ludo’.




^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: %module-public-interface
  2010-04-02  9:37         ` %module-public-interface Ludovic Courtès
@ 2010-04-02 11:58           ` Ian Hulin
  2010-04-02 18:50             ` %module-public-interface Patrick McCarty
  2010-04-06 14:00             ` %module-public-interface Han-Wen Nienhuys
  0 siblings, 2 replies; 21+ messages in thread
From: Ian Hulin @ 2010-04-02 11:58 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: lilypond-devel@gnu.org, guile-devel

On 02/04/10 10:37, Ludovic � wrote:
> Hi Ian,
>
> Ian Hulin<ian@hulin.org.uk>  writes:
>
>    
>> On 30/03/10 22:52, Ludovic � wrote:
>>      
>    
>>> Andy Wingo<wingo@pobox.com>   writes:
>>>
>>>        
>>>> On Tue 30 Mar 2010 22:56, ludo@gnu.org (Ludovic Courtès) writes:
>>>>
>>>>          
>>>>>> I'm pretty sure that the submodule thing can be changed without any
>>>>>> problem. But it seems that the %module-public-interface is used
>>>>>> explicitly, at least by texmacs and lilypond.
>>>>>>              
>>>>> How do they use it?
>>>>>            
>>>> Linking to the evil empire:
>>>>
>>>> http://www.google.com/codesearch?hl=en&lr=&q=%25module-public-interface&sbtn=Search
>>>> http://www.google.com/codesearch?hl=en&lr=&q=%25module-public-interface+lang%3Ac%2B%2B&sbtn=Search
>>>>          
>>> 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.)
>>>
>>>        
>>      
>>> TeXmacs does:
>>>        
>> <snip>
>>      
>>>>> And we could add a ‘public-interface’ slot to ‘module-type’ and have
>>>>> ‘module-public-interface’ and ‘set-module-public-interface!’ refer to
>>>>> it; for backward compatibility we’d also initialize the
>>>>> ‘%module-public-interface’ binding.  How does it sound?
>>>>>            
>>> Actually the trick wouldn’t work in cases where the
>>> ‘%module-public-interface’ binding is mutated, as with Lilypond.
>>>
>>> Given this and the above examples, I’d suggest dropping that binding
>>> completely and sending patches to the Lilypond/TeXmacs people.
>>>
>>> What do you think?
>>>        
>> If you do add scm_set_module_public_interface_x, could you back-port
>> it to Guile V1.8.6 and V1.8.7?
>>      
> We could back-port it to the 1.8 series, but not to the already-released
> 1.8.7 and 1.8.6.  We’d have to make a 1.8.8 release, but I’m not sure
> that would really help anyway since that would force Lilypond users to
> switch to that version.
>
>    
>> Those are the lowest versions of Guile the upcoming stable release of
>> Lilypond will support.
>>      
> How about doing #ifdef HAVE_SCM_SET_MODULE_PUBLIC_INTERFACE_X in your
> code?
>
> We still have to agree on the change and actually implement it, the
> latter being easy. ;-)
I'm sure that would be easy enough, if guile provided 
HAVE_SCM_SET_MODULE_PUBLIC_INTERFACE_X in the V2.0
guile-config (or the pkg-config guile-2.0 data which I believe is 
replacing it), that looks like it would be the most painless route for 
both projects.

> When is the new Lilypond release due?
>
>    
I'm not the ReleaseMeister for Lilypond; you'll get a better picture by 
talking to Graham Percival (graham@percival-music.ca).

But FWIW it looks like we're on our few last development releases before 
the stable V2.14 comes out.  It's near enough for a spoof release 
announcement to have gone out on the mailing list on April 1st which 
suckered me!

I reckon plans are for Lilypond to stick with Guile V1.8.7 at least 
until the next Lilypond stable version after V2.14, but again, mileage 
may vary if you talk to more experienced Lilypond people.

Currently there are only a couple of people in the Pond looking at 
Lilypond/Guile V2.0 transition, and there are a few compatibiilty 
breakages we've identified.

1. Lilypond configure looks at guile-config --version to get the guile 
version - the guile V2.0 guile-config says it's being deprecated in 
favour of pkg-config --atleast-version/--exact-version/--max-version.

2. Lilypond has *lots* of guile code which it needs to build the project.

3. There's a  restriction introduced in Guile V2.0 whereby dynamic use 
of define, define-public and variants will cause the guile compilation 
to fail with diagnostics.  We have these in our basic Scheme files 
(lily.scm and lily-library.scm).  These compilation failures currently 
stop Lilypond building altogether.

4. We've already seen the %module-public-interface thing in the Lily 
C++.  There's probably more smelly stuff lurking in the C++ interface, 
which won't surface until we start trying to use Guile 2.0 more.

Graham, Vincent, is it worth opening a tracker to capture 
forward-compatibility issues with Guile?

Thanks for your feedback so far, Ludo.  The other Lily developer who has 
done anything with Guile 1.9/V2.0 is Patrick McCarty (pnorks@gmail.com).

Cheers,

Ian




^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: %module-public-interface
  2010-04-02 11:58           ` %module-public-interface Ian Hulin
@ 2010-04-02 18:50             ` Patrick McCarty
  2010-04-03  0:52               ` %module-public-interface Graham Percival
  2010-04-06 14:00             ` %module-public-interface Han-Wen Nienhuys
  1 sibling, 1 reply; 21+ messages in thread
From: Patrick McCarty @ 2010-04-02 18:50 UTC (permalink / raw)
  To: Ian Hulin; +Cc: Ludovic Courtès, guile-devel, lilypond-devel

On 2010-04-02, Ian Hulin wrote:
> 
> 3. There's a  restriction introduced in Guile V2.0 whereby dynamic
> use of define, define-public and variants will cause the guile
> compilation to fail with diagnostics.  We have these in our basic
> Scheme files (lily.scm and lily-library.scm).  These compilation
> failures currently stop Lilypond building altogether.

This is really just a stricter adherence to the Scheme R5RS.

(if ...) can only contain *expressions*, IIUC, and (define ...) is a
top-level definition, not an expression.

But yes, either LilyPond will need to adapt to these stricter
guidelines, or Guile will loosen its policy with respect to (if ...)
statements.

> 4. We've already seen the %module-public-interface thing in the Lily
> C++.  There's probably more smelly stuff lurking in the C++
> interface, which won't surface until we start trying to use Guile
> 2.0 more.

I think almost everything is fixed on the C++ side now.

> Graham, Vincent, is it worth opening a tracker to capture
> forward-compatibility issues with Guile?

We already have one (sort of):
http://code.google.com/p/lilypond/issues/detail?id=963

> Thanks for your feedback so far, Ludo.  The other Lily developer who
> has done anything with Guile 1.9/V2.0 is Patrick McCarty
> (pnorks@gmail.com).

That's <pnorcks@gmail.com>.  I don't want any email reaching the wrong
mailbox.  :-)

-Patrick

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: %module-public-interface
  2010-04-02 18:50             ` %module-public-interface Patrick McCarty
@ 2010-04-03  0:52               ` Graham Percival
  0 siblings, 0 replies; 21+ messages in thread
From: Graham Percival @ 2010-04-03  0:52 UTC (permalink / raw)
  To: Patrick McCarty
  Cc: Ian Hulin, Ludovic Courtès, lilypond-devel, guile-devel

On Fri, Apr 02, 2010 at 11:50:08AM -0700, Patrick McCarty wrote:
> On 2010-04-02, Ian Hulin wrote:
> > 
> > Graham, Vincent, is it worth opening a tracker to capture

ITYM Valentin.

> > forward-compatibility issues with Guile?
> 
> We already have one (sort of):
> http://code.google.com/p/lilypond/issues/detail?id=963

Not really; that's intended for things like "we need to use
fontforge 2010.03.02 or higher!".  And it'll be closed in a few
weeks.


I've added issue 1055:
http://code.google.com/p/lilypond/issues/detail?id=1055

Cheers,
- Graham

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: %module-public-interface
  2010-04-02 11:58           ` %module-public-interface Ian Hulin
  2010-04-02 18:50             ` %module-public-interface Patrick McCarty
@ 2010-04-06 14:00             ` Han-Wen Nienhuys
  2010-04-06 14:32               ` %module-public-interface Ludovic Courtès
  1 sibling, 1 reply; 21+ messages in thread
From: Han-Wen Nienhuys @ 2010-04-06 14:00 UTC (permalink / raw)
  To: Ian Hulin; +Cc: Ludovic Courtès, guile-devel, lilypond-devel@gnu.org

On Fri, Apr 2, 2010 at 8:58 AM, Ian Hulin <ian@hulin.org.uk> wrote:
>>>>>> How do they use it?
>>>>>>
>>>>>
>>>>> Linking to the evil empire:
>>>>> http://www.google.com/codesearch?hl=en&lr=&q=%25module-public-interface&sbtn=Search

(ehh?)


>> When is the new Lilypond release due?
>>
>>
>
> I'm not the ReleaseMeister for Lilypond; you'll get a better picture by
> talking to Graham Percival (graham@percival-music.ca).
>
> But FWIW it looks like we're on our few last development releases before the
> stable V2.14 comes out.  It's near enough for a spoof release announcement
> to have gone out on the mailing list on April 1st which suckered me!
>
> I reckon plans are for Lilypond to stick with Guile V1.8.7 at least until
> the next Lilypond stable version after V2.14, but again, mileage may vary if
> you talk to more experienced Lilypond people.

Is Guile 2.0 already released?

I think it makes sense to forget about guile 2.0 for the 2.14 release,
and require 2.0 for the 2.16 release.  We could scrap lots of hairy GC
code if we could move to 2.0 (2.0 supports boehm GC, right?)


> 4. We've already seen the %module-public-interface thing in the Lily C++.
>  There's probably more smelly stuff lurking in the C++ interface, which
> won't surface until we start trying to use Guile 2.0 more.

There may be lots of hairiness in the module interface; I sort of made
up functions as I went along, since it was largely undocumented.

-- 
Han-Wen Nienhuys - hanwen@xs4all.nl - http://www.xs4all.nl/~hanwen




^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: %module-public-interface
  2010-04-06 14:00             ` %module-public-interface Han-Wen Nienhuys
@ 2010-04-06 14:32               ` Ludovic Courtès
  0 siblings, 0 replies; 21+ messages in thread
From: Ludovic Courtès @ 2010-04-06 14:32 UTC (permalink / raw)
  To: hanwen; +Cc: Ian Hulin, guile-devel, lilypond-devel@gnu.org

Hi,

Han-Wen Nienhuys <hanwenn@gmail.com> writes:

> On Fri, Apr 2, 2010 at 8:58 AM, Ian Hulin <ian@hulin.org.uk> wrote:

[...]

>> I'm not the ReleaseMeister for Lilypond; you'll get a better picture by
>> talking to Graham Percival (graham@percival-music.ca).
>>
>> But FWIW it looks like we're on our few last development releases before the
>> stable V2.14 comes out.  It's near enough for a spoof release announcement
>> to have gone out on the mailing list on April 1st which suckered me!
>>
>> I reckon plans are for Lilypond to stick with Guile V1.8.7 at least until
>> the next Lilypond stable version after V2.14, but again, mileage may vary if
>> you talk to more experienced Lilypond people.
>
> Is Guile 2.0 already released?

No.  1.9 pre-releases are available from alpha.gnu.org (make sure to
give it a try!); 2.0 should happen within a couple of months.

> I think it makes sense to forget about guile 2.0 for the 2.14 release,
> and require 2.0 for the 2.16 release.  We could scrap lots of hairy GC
> code if we could move to 2.0 (2.0 supports boehm GC, right?)

Yes.

Thanks,
Ludo’.




^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: %module-public-interface
  2010-04-02  0:11       ` %module-public-interface Ian Hulin
  2010-04-02  9:37         ` %module-public-interface Ludovic Courtès
@ 2010-04-27 20:34         ` Andy Wingo
  2010-05-15 20:32           ` %module-public-interface Ian Hulin
  1 sibling, 1 reply; 21+ messages in thread
From: Andy Wingo @ 2010-04-27 20:34 UTC (permalink / raw)
  To: Ian Hulin; +Cc: lilypond-devel@gnu.org, guile-devel

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
-- 
http://wingolog.org/




^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: %module-public-interface
  2010-04-27 20:34         ` %module-public-interface Andy Wingo
@ 2010-05-15 20:32           ` Ian Hulin
  2010-05-21  9:48             ` %module-public-interface Andy Wingo
  0 siblings, 1 reply; 21+ messages in thread
From: Ian Hulin @ 2010-05-15 20:32 UTC (permalink / raw)
  To: guile-devel; +Cc: lilypond-devel

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





^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: %module-public-interface
  2010-05-15 20:32           ` %module-public-interface Ian Hulin
@ 2010-05-21  9:48             ` Andy Wingo
  0 siblings, 0 replies; 21+ messages in thread
From: Andy Wingo @ 2010-05-21  9:48 UTC (permalink / raw)
  To: Ian Hulin; +Cc: lilypond-devel, guile-devel

On Sat 15 May 2010 22:32, Ian Hulin <ian@hulin.org.uk> writes:

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

Yep, it's in git.

Cheers,

Andy
-- 
http://wingolog.org/



^ permalink raw reply	[flat|nested] 21+ messages in thread

* %module-public-interface
@ 2020-01-15  6:50 dsmich
  2020-01-15 19:59 ` %module-public-interface Andy Wingo
  0 siblings, 1 reply; 21+ messages in thread
From: dsmich @ 2020-01-15  6:50 UTC (permalink / raw)
  To: 'guile-devel@gnu.org'

[-- Attachment #1: Type: text/plain, Size: 440 bytes --]

(Sorry for the non-plain-test formatting, haven't the new mailer
interface from Spectrum yet. Ugh.)

	I'm porting some old code to 3.0 and I've come across this:

	(define-module (bobotpp bot))

	(set-module-uses! %module-public-interface

	 (list (module-ref (resolve-module '(guile-user) #f)

	 'the-bot-module)))

	What is the 3.0 equivalent? I'm not sure what the above is trying to
do.

	Thanks,

	 -Dale

	What s

[-- Attachment #2: Type: text/html, Size: 1135 bytes --]

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: %module-public-interface
  2020-01-15  6:50 %module-public-interface dsmich
@ 2020-01-15 19:59 ` Andy Wingo
  0 siblings, 0 replies; 21+ messages in thread
From: Andy Wingo @ 2020-01-15 19:59 UTC (permalink / raw)
  To: dsmich; +Cc: 'guile-devel@gnu.org'

On Wed 15 Jan 2020 07:50, dsmich@roadrunner.com writes:

> I'm porting some old code to 3.0 and I've come across this:
>
> (define-module (bobotpp bot))
>
> (set-module-uses! %module-public-interface
>
>                   (list (module-ref (resolve-module '(guile-user) #f)
>
>                                     'the-bot-module)))
>
> What is the 3.0 equivalent?   I'm not sure what the above is trying to do.

As mentioned in IRC, (module-public-interface (current-module)).  (This
change was part of 2.0.)

Cheers,

Andy



^ permalink raw reply	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2020-01-15 19:59 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-15  6:50 %module-public-interface dsmich
2020-01-15 19:59 ` %module-public-interface Andy Wingo
  -- strict thread matches above, loose matches on Subject: below --
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           ` %module-public-interface Ian Hulin
2010-05-21  9:48             ` %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

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).