From: Rob Browning <rlb@defaultvalue.org>
Cc: guile-devel@gnu.org
Subject: Re: scm_* API extension? [was] scm_* API question
Date: Wed, 31 Jul 2002 17:14:56 -0500 [thread overview]
Message-ID: <8765yva6jj.fsf@raven.i.defaultvalue.org> (raw)
In-Reply-To: <20020731150602.A32555@kiwi.pyrotechnics.com> (Christopher Cramer's message of "Wed, 31 Jul 2002 15:06:02 -0500")
Christopher Cramer <crayc@pyro.net> 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
next prev parent reply other threads:[~2002-07-31 22:14 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-07-30 12:14 scm_* API question rm
2002-07-31 1:09 ` Christopher Cramer
2002-07-31 10:03 ` scm_* API extension? [was] " rm
2002-07-31 10:10 ` Marius Vollmer
2002-07-31 18:21 ` rm
2002-07-31 21:59 ` Rob Browning
2002-08-01 10:10 ` rm
2002-08-01 16:51 ` Rob Browning
2002-08-05 15:08 ` Marius Vollmer
2002-08-05 16:06 ` rm
2002-08-05 16:49 ` Marius Vollmer
2002-07-31 20:06 ` Christopher Cramer
2002-07-31 22:14 ` Rob Browning [this message]
2002-08-01 9:41 ` rm
2002-08-05 17:51 ` Marius Vollmer
2002-08-05 18:12 ` Han-Wen Nienhuys
2002-08-05 18:45 ` Rob Browning
2002-08-05 18:31 ` Rob Browning
2002-08-05 18:33 ` rm
2002-08-05 15:12 ` Marius Vollmer
2002-07-31 10:11 ` Marius Vollmer
2002-07-31 10:30 ` rm
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=8765yva6jj.fsf@raven.i.defaultvalue.org \
--to=rlb@defaultvalue.org \
--cc=guile-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).