From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Ian Hulin Newsgroups: gmane.lisp.guile.user Subject: Re: make-module question. Date: Sat, 04 Sep 2010 22:10:41 +0100 Message-ID: <4C82B5D1.60707@hulin.org.uk> References: <4C61A7C4.4030302@hulin.org.uk> <8739ucnhly.fsf@gnu.org> <4C6C5225.1010806@hulin.org.uk> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Trace: dough.gmane.org 1283634989 10907 80.91.229.12 (4 Sep 2010 21:16:29 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sat, 4 Sep 2010 21:16:29 +0000 (UTC) Cc: =?UTF-8?B?THVkb3ZpYyBDb3VydMOocw==?= , guile-user@gnu.org To: Andy Wingo Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Sat Sep 04 23:16:27 2010 Return-path: Envelope-to: guile-user@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 1Os065-0000DB-Lm for guile-user@m.gmane.org; Sat, 04 Sep 2010 23:16:26 +0200 Original-Received: from localhost ([127.0.0.1]:55903 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Os064-0006im-MZ for guile-user@m.gmane.org; Sat, 04 Sep 2010 17:16:24 -0400 Original-Received: from [140.186.70.92] (port=41062 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Os05g-0005k0-A0 for guile-user@gnu.org; Sat, 04 Sep 2010 17:16:01 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1Os00d-000241-7K for guile-user@gnu.org; Sat, 04 Sep 2010 17:10:48 -0400 Original-Received: from asmtp3.iomartmail.com ([62.128.201.159]:55188) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Os00b-00023k-CD; Sat, 04 Sep 2010 17:10:45 -0400 Original-Received: from asmtp3.iomartmail.com (localhost.localdomain [127.0.0.1]) by asmtp3.iomartmail.com (8.13.8/8.13.8) with ESMTP id o84LAght004644; Sat, 4 Sep 2010 22:10:42 +0100 Original-Received: from [192.168.1.100] (cpc3-rdng6-0-0-cust547.15-3.cable.virginmedia.com [82.10.50.36]) (authenticated bits=0) by asmtp3.iomartmail.com (8.13.8/8.13.8) with ESMTP id o84LAf2H004639; Sat, 4 Sep 2010 22:10:42 +0100 User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.8) Gecko/20100802 Lightning/1.0b3pre Thunderbird/3.1.2 Original-Newsgroups: gmane.lisp.guile.user In-Reply-To: X-Enigmail-Version: 1.1.1 X-MIME-Autoconverted: from 8bit to quoted-printable by asmtp3.iomartmail.com id o84LAf2H004639 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: guile-user-bounces+guile-user=m.gmane.org@gnu.org Errors-To: guile-user-bounces+guile-user=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.user:8154 Archived-At: Hi Andy, On 29/08/10 20:05, Andy Wingo wrote: > Greets, >=20 > On Wed 18 Aug 2010 14:35, Ian Hulin writes: >=20 >> On 18/08/10 15:03, Ludovic Court=C3=A8s wrote: >>> Ian Hulin writes: >>>> Also what are the args the REPL says you can supply to (make-module)= ?. >=20 >> It looks like there are three optional parameters, and the code is >> trying to do a home-grown version of (ice-9 optargs) [...] >=20 > In git, the definition begins: >=20 > (define* (make-module #:optional (size 31) (uses '()) (binder #f)) > ...) >=20 >> As the lilypond C++ routine immediately adds stuff to the uses list it >> could be useful to call make-module with this parameter. >> However, how do you call the thing while getting it to accept that you >> don't want to pass it the first parameter and want to let it default t= he >> value, but the first positional one you are passing is actually the >> second actual one, as you don't have any list separators in Scheme lik= e >> in C++, or Pascal or whatever. So Scheme cannot distinguish between >> (make-module ( my-obarray-size)) and (make-module ( my-uses-list)) >> whereas a language with list-element separators could make this clear >> make-module ( my_obbaray_size, , ); >> and make-module ( , my_uses_list , ); >=20 > You use #:key instead of #:optional arguments. make-module needs to be > declared to have #:key arguments, though, which is not currently the > case. >=20 Then I have two questions; If #:key is a superset of #:optional, and allows you to specify parameters positionally without the keywords if you're omitting parameters from the right-hand end (make-module my_obarray-size my_uses_list) or (make-module my_obarray-size) but if you omit the size or uses parameter you have to use keywords (make-module #:uses '((ice-9 syncase) (ice-9 debug))). If this is the case, could I request an enhancement for this the base code to declared using (define* (make-module #:key (size 31) (uses '()) (binder #f)) ...) If make-module is declared using #;key, how would this affect calling it from code with scm_call_1, scm_call_2, scm_call_3 or scm_call_n? Would we need to pass the keywords as separate parameters like this, SCM scm_make_module_x =3D SCM_EOL; SCM keyname =3D scm_str2symbol ("#;uses"); SCM modlist =3D scm_list_2 (scm_str2sym("ice-9 syncase"), scm_str2sym("ice-9 debug")) scm_permanent_object (scm_c_lookup ("make-module")); scm_call_2( SCM_VARIABLE_REF (scm_make_module_x), keyname, modlist): or like this, with a place-holder blank parameter for the size parameter with SCM_EOL or SCM_BOOL_F? scm_call_2 (SCM_VARIABLE_REF (scm_make_module_x), SCM_BOOL_F, modlist); Cheers, Ian Hulin