From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Ian Hulin Newsgroups: gmane.lisp.guile.devel,gmane.comp.gnu.lilypond.devel Subject: Re: %module-public-interface Date: Sat, 15 May 2010 21:32:41 +0100 Message-ID: <4BEF04E9.4060301@hulin.org.uk> References: <87zl1pv89p.fsf@gnu.org> <87d3ylv5oe.fsf@gnu.org> <4BB53617.7060700@hulin.org.uk> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Trace: dough.gmane.org 1273955586 10145 80.91.229.12 (15 May 2010 20:33:06 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sat, 15 May 2010 20:33:06 +0000 (UTC) Cc: lilypond-devel@gnu.org To: guile-devel@gnu.org Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Sat May 15 22:33:05 2010 connect(): No such file or directory Return-path: Envelope-to: guile-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1ODO2i-00044M-QQ for guile-devel@m.gmane.org; Sat, 15 May 2010 22:33:05 +0200 Original-Received: from localhost ([127.0.0.1]:39948 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1ODO2i-0002Pp-0O for guile-devel@m.gmane.org; Sat, 15 May 2010 16:33:04 -0400 Original-Received: from [140.186.70.92] (port=36332 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1ODO2a-0002Ph-TS for guile-devel@gnu.org; Sat, 15 May 2010 16:32:57 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1ODO2X-0005C7-WF for guile-devel@gnu.org; Sat, 15 May 2010 16:32:56 -0400 Original-Received: from lo.gmane.org ([80.91.229.12]:51836) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1ODO2X-0005Bn-LG for guile-devel@gnu.org; Sat, 15 May 2010 16:32:53 -0400 Original-Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1ODO2T-0003yf-Jp for guile-devel@gnu.org; Sat, 15 May 2010 22:32:49 +0200 Original-Received: from cpc3-rdng6-0-0-cust547.winn.cable.ntl.com ([82.10.50.36]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sat, 15 May 2010 22:32:49 +0200 Original-Received: from ian by cpc3-rdng6-0-0-cust547.winn.cable.ntl.com with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sat, 15 May 2010 22:32:49 +0200 X-Injected-Via-Gmane: http://gmane.org/ connect(): No such file or directory Original-Lines: 73 Original-X-Complaints-To: usenet@dough.gmane.org X-Gmane-NNTP-Posting-Host: cpc3-rdng6-0-0-cust547.winn.cable.ntl.com User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.9) Gecko/20100317 Lightning/1.0b1 Thunderbird/3.0.4 In-Reply-To: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Errors-To: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.devel:10331 gmane.comp.gnu.lilypond.devel:29117 Archived-At: Hi Andy, On 27/04/10 21:34, Andy Wingo wrote: > Hi Ian, > > On Fri 02 Apr 2010 02:11, Ian Hulin 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