unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
From: Rob Browning <rlb@defaultvalue.org>
Cc: guile-devel@gnu.org
Subject: Re: Smart variables, dumb variables
Date: Wed, 14 Aug 2002 16:31:28 -0500	[thread overview]
Message-ID: <87znvpf7pr.fsf@raven.i.defaultvalue.org> (raw)
In-Reply-To: <87y9bajzfp.fsf@zagadka.ping.de> (Marius Vollmer's message of "13 Aug 2002 22:06:50 +0200")

Marius Vollmer <mvo@zagadka.ping.de> writes:

> For example, Emacs has the ability to forward references to Elisp
> variables to C variables.  C code can use a normal "int" variable,
> say, and Elisp code can use that variable as well.  Translating
> between Elisp representation and C representation of values is done
> transparently, when Elisp accesses the variable.  RMS convinced me
> that that would be a nice feature for Guile as well, in general.
>
> One might say that it is probably better to not use variables for
> this, but rather have a more abstract interface using setter and
> getter functions.  But when designed carefully. the need to use
> stters/getters for things that are in all respects just variables can
> also feel awkward.  A good example are the forwarding variables of
> Emacs.  It shouldn't really be visible to Elisp code that the
> variables are forwarded to C variables (although they don't allow
> non-integer values, thus making them different from other Elisp
> variables, hmm).

Hmm, my initial reaction is that this kind of "transparency" always
makes me nervous.  In fact I'd probably be happier if emacs made some
of the operations *more* explicit.  i.e. I'd rather see

  (set-customized-var! some-foo value)

rather than have to remeber that

  (set! some-foo value)

may be doing all kinds of fancy operations I'm not aware of, depending
on a definitions that may not be visible at the scheme level.  Also,
sticking with functions rather than raw variables for important
"globals" makes your life far less unpleasant if/when you decide you
want or need to function in the presence of (preemtive) threads.

However, I understand the reasoning, so I wonder whether or not we
might be able to come up with a broader solution (as you alluded to)
to start with.  We already have goops and procedures with setters --
can we come up with something along those lines that can still be
optimized (even if we can't do that optimization right now)?  If so,
those optimizations might help elsewhere too.  Questions: how bad
would the overhead for "raw variables" be if we moved in this
direction, and is our current bottleneck really raw variable accesses?

Overall, I guess I just have a reflexive nervousness wrt "magic
variables".  If nothing else, they make code that much more mysterious
to anyone coming to a project/language from the outside, but all that
said -- I'm already strongly opposed or anything, just wary.

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


  parent reply	other threads:[~2002-08-14 21:31 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-08-13 20:06 Smart variables, dumb variables Marius Vollmer
2002-08-14  8:07 ` tomas
2002-08-14 19:35   ` Marius Vollmer
2002-08-14 20:28     ` tomas
2002-08-14 20:48       ` Marius Vollmer
2002-08-14 21:06         ` rm
2002-08-14 21:09           ` Marius Vollmer
2002-08-15  8:06             ` rm
2002-08-15  8:01               ` Lynn Winebarger
2002-08-15  9:51                 ` rm
2002-08-15 14:44               ` Rob Browning
2002-08-15 16:34               ` Marius Vollmer
2002-08-15 17:27                 ` rm
2002-08-15 19:43                   ` Marius Vollmer
2002-08-15 20:02                     ` rm
2002-08-15 20:02                       ` Marius Vollmer
2002-08-15 20:25                         ` rm
2002-08-17 11:59                         ` Neil Jerram
2002-08-19 23:29                         ` Marius Vollmer
2002-08-20 12:01                           ` rm
2002-08-26 22:06                             ` Marius Vollmer
2002-08-15 10:52         ` tomas
2002-08-15 16:36           ` Marius Vollmer
2002-08-14 21:31 ` Rob Browning [this message]
2002-08-14 21:45   ` Marius Vollmer
2002-08-15  2:43 ` Rob Browning
2002-08-15  6:29   ` Marius Vollmer
2002-08-15 14:38     ` Rob Browning

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=87znvpf7pr.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).