From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Rob Browning Newsgroups: gmane.lisp.guile.devel Subject: Re: scm_* API extension? [was] scm_* API question Date: Wed, 31 Jul 2002 17:14:56 -0500 Sender: guile-devel-admin@gnu.org Message-ID: <8765yva6jj.fsf@raven.i.defaultvalue.org> References: <20020730121436.GA4465@www> <20020730200929.A18106@kiwi.pyrotechnics.com> <20020731100300.GC5661@www> <20020731150602.A32555@kiwi.pyrotechnics.com> NNTP-Posting-Host: localhost.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: main.gmane.org 1028153681 16955 127.0.0.1 (31 Jul 2002 22:14:41 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Wed, 31 Jul 2002 22:14:41 +0000 (UTC) Cc: guile-devel@gnu.org Return-path: Original-Received: from fencepost.gnu.org ([199.232.76.164]) by main.gmane.org with esmtp (Exim 3.33 #1 (Debian)) id 17a1js-0004PL-00 for ; Thu, 01 Aug 2002 00:14:40 +0200 Original-Received: from localhost ([127.0.0.1] helo=fencepost.gnu.org) by fencepost.gnu.org with esmtp (Exim 3.35 #1 (Debian)) id 17a1kL-00088T-00; Wed, 31 Jul 2002 18:15:09 -0400 Original-Received: from dsl-209-87-109-2.constant.com ([209.87.109.2] helo=defaultvalue.org) by fencepost.gnu.org with esmtp (Exim 3.35 #1 (Debian)) id 17a1k9-00087k-00 for ; Wed, 31 Jul 2002 18:14:57 -0400 Original-Received: from raven.i.defaultvalue.org (raven.i.defaultvalue.org [192.168.1.7]) by defaultvalue.org (Postfix) with ESMTP id 2460E3D5C; Wed, 31 Jul 2002 17:14:57 -0500 (CDT) Original-Received: by raven.i.defaultvalue.org (Postfix, from userid 1000) id ED97B1457; Wed, 31 Jul 2002 17:14:56 -0500 (CDT) Original-To: Marius Vollmer In-Reply-To: <20020731150602.A32555@kiwi.pyrotechnics.com> (Christopher Cramer's message of "Wed, 31 Jul 2002 15:06:02 -0500") Original-Lines: 45 User-Agent: Gnus/5.090006 (Oort Gnus v0.06) Emacs/21.2 (i386-pc-linux-gnu) Errors-To: guile-devel-admin@gnu.org X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.0.11 Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: Developers list for Guile, the GNU extensibility library List-Unsubscribe: , List-Archive: Xref: main.gmane.org gmane.lisp.guile.devel:907 X-Report-Spam: http://spam.gmane.org/gmane.lisp.guile.devel:907 Christopher Cramer writes: > I have no idea why you think it would better, but with certain types > of applications, it's impossible. There are also cases where it seems clearer if the C side deals with modules explicitly. For example, we had a decent amount of trouble in gnucash because we were using gh_eval_str on the C side to get scheme side bindings we needed in certain situations. This was a while back (started years ago in fact), and before we fully realized how guile's module system worked. Switching to scm_c_module_ref (or other forms of explicit lookup) makes it much clearer in the code what's actually going on, and certainly makes it more likely to "do what we mean :>". I think at least initially it can be easy to forget that on the C side, there's no such thing as a lexical current-module. In the cases I've run in to, one of the most common situations was that the C code needed to look up a variable or function on the scheme side and then use it. In many cases the code *could* have been rewritten to avoid the use of the C->scheme lookup, but in some cases such a change would have made the code a lot more complex than necessary. Sometimes all you want is (this is definitely just psuedo-code): void magic_button_callback () { gh_call0(scm_c_module_lookup(..., "magic-button-callback")); } sometoolkit_button_attach_callback(button, magic_button_callback); and in this case, maybe you *want* the button press to use whatever's currently bound to 'magic-button-callback -- a-la emacs 'foo rather than just what was bound when you attached the callback. There are defintely other ways you could handle this, but this seems pretty straightforward... FWIW -- Rob Browning rlb @defaultvalue.org, @linuxdevel.com, and @debian.org Previously @cs.utexas.edu GPG=1C58 8B2C FB5E 3F64 EA5C 64AE 78FE E5FE F0CB A0AD _______________________________________________ Guile-devel mailing list Guile-devel@gnu.org http://mail.gnu.org/mailman/listinfo/guile-devel