unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Ken Raeburn <raeburn@raeburn.org>
Cc: emacs-devel@gnu.org
Subject: Re: emacs and guile (Re: ehelp woes, or why I hate a module that I love so much)
Date: Thu, 18 Jul 2002 15:54:43 -0400	[thread overview]
Message-ID: <tx11ya0x14s.fsf@raeburn.org> (raw)
In-Reply-To: <200207181456.g6IEu0J25108@aztec.santafe.edu> (Richard Stallman's message of "Thu, 18 Jul 2002 08:56:00 -0600 (MDT)")

Richard Stallman <rms@gnu.org> writes:
> I don't think this method makes real sense, because if an object is
> going to have the scheme object header at all, we may as well use that
> object header universaly throughout Emacs as the way to reference the
> object.  It would cost no extra storage, and it would be simpler.

It would certainly be simpler, just a little slower as the
object-to-pointer conversions are done multiple times, particularly
when a function called frequently is changed from taking a pointer
argument to taking a lisp object.  I've made a few changes along those
lines, and will almost certainly make more.

> Why can't Guile's symbols be used as Lisp symbols?

Actually, the issue is the symbol's value(s).  Scheme symbols don't
have separate function and value slots.  Emacs Lisp symbols have a few
other fields associated with them, like indirect_variable, that also
don't fit the basic Scheme model.  And if we separate the name from
the values, there's the question of what exactly a symbol is.

There are several ways to deal with this.

Some involve changing Guile's symbol representation to have the extra
fields.  IMNSHO this is tantamount to declaring Scheme not to be up to
the task of implementing Lisp, and I'm not prepared to believe that.
(That Guile isn't currently up to the task, maybe; we'll find out, and
Guile's Scheme implementation can be improved.  That Scheme can't do
it, no.)  It also sets a poor example for people wanting to put other
existing languages on top of Guile.

Another approach would be to use Scheme symbols, but store as their
values vectors containing the various fields of a Lisp symbol.
Special accessor functions would be needed for Scheme code to
manipulate Lisp variables, and while I don't have a problem with that,
the people who want transparent interaction between the two languages
probably won't like it.  I guess it depends whether you view it as
Lisp on top of Scheme, or the two languages working side by side.  I'm
inclined towards the former view, maybe only because it's easier for
an implementor or designer, but I understand the temptation of the
latter for such similar languages.

But in that case, how do you implement Lisp's "symbolp" when looking
at Scheme objects?  Is a Lisp symbol a Scheme symbol that has a
particular kind of object as its value?  Should other Scheme symbols
be treated as Lisp symbols?  If a Scheme symbol has a value, what
happens if you do an "fset" or "let" on it in Lisp?  (Maybe that's an
argument for separate namespaces for Scheme and Lisp symbols, outside
of explicitly requested sharing.)

Treating Lisp symbols as a new type is a third approach.  (Either an
opaque type, or a vector as above but also including the symbol's
name.)  It's what I did before, and it does sidestep a lot of these
issues by simply not allowing any sort of confusion between the two
symbol types, but it's not as appealing as using Scheme symbols.


A related issue is the symbol name -- a Lisp symbol name is a Lisp
string, with some of the associated fields ignored for matching
purposes.  The names themselves can have text properties:

    ELISP> (symbol-name 'booga-booga)
    #("booga-booga" 0 3 nil 3 6
      (some-prop some-val)
      6 11 nil)

(I got this by previously interning a string with the same contents
and some text properties.)

An Emacs Lisp symbol's name can also be changed after interning, such
that it won't be found when interning either the old name or
(probably) the new name.  I don't know what Scheme's specifications
might say about such cases.  (Much as I like Scheme, I'm hardly an
expert; on subtle Scheme issues I'll readily defer to others.)

I really hope no one is relying on such weird behavior, but if it
needs to be maintained, that's another complication.


Because I don't have all the answers, I think it's simplest to plan to
treat them as separate types initially, and then merge them if and
when we decide a particular approach will work well in all cases we
care about, perhaps even before the actual coding starts, but perhaps
not; worst case, we change a few Lisp macros to just invoke Guile
macros.  It's easier than starting coding on the assumption that
they'll be the same, and then finding that we have to separate them.

Ken

  reply	other threads:[~2002-07-18 19:54 UTC|newest]

Thread overview: 56+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-06-25 14:50 ehelp woes, or why I hate a module that I love so much Juanma Barranquero
2002-06-25 15:06 ` D. Goel
2002-06-25 15:41   ` Juanma Barranquero
2002-06-26 22:24 ` Richard Stallman
2002-06-27 17:11   ` Juanma Barranquero
2002-06-27 19:57     ` Stefan Monnier
2002-07-02 15:02       ` Juanma Barranquero
2002-07-02 15:18         ` Stefan Monnier
2002-07-02 15:50           ` Juanma Barranquero
2002-06-29  8:41     ` Richard Stallman
2002-07-02 15:15       ` Juanma Barranquero
2002-07-02 15:49         ` Eli Zaretskii
2002-07-03 11:16           ` Juanma Barranquero
2002-07-03 20:57         ` Richard Stallman
2002-07-03 21:32           ` Simon Josefsson
2002-07-04  5:09             ` Eli Zaretskii
2002-07-04  7:58           ` Juanma Barranquero
2002-07-04 10:13             ` Eli Zaretskii
2002-07-04 11:52               ` Juanma Barranquero
2002-07-06 10:38                 ` Eli Zaretskii
2002-07-04 11:02             ` Simon Josefsson
2002-07-04 12:08               ` Juanma Barranquero
2002-07-04 12:19                 ` Miles Bader
2002-07-04 13:31                   ` Juanma Barranquero
2002-07-04 14:02                   ` Simon Josefsson
2002-07-04 14:00                 ` Simon Josefsson
2002-07-04 15:20                   ` Juanma Barranquero
2002-07-17  2:58                     ` emacs and guile (Re: ehelp woes, or why I hate a module that I love so much) Ken Raeburn
2002-07-17  7:13                       ` Juanma Barranquero
2002-07-17  9:11                       ` Kai Großjohann
2002-07-18 14:54                         ` Richard Stallman
2002-07-18 21:45                         ` Ken Raeburn
2002-07-18 14:55                       ` Richard Stallman
2002-07-18 20:13                         ` Ken Raeburn
2002-07-19 13:03                           ` Andreas Schwab
2002-07-19 16:24                             ` Ken Raeburn
2002-07-19 16:54                           ` Richard Stallman
2002-07-19 17:51                             ` Ken Raeburn
2002-07-18 14:56                       ` Richard Stallman
2002-07-18 19:54                         ` Ken Raeburn [this message]
2002-07-19  4:23                           ` Stefan Monnier
2002-07-19 12:56                             ` Ken Raeburn
2002-07-19 13:34                               ` Stefan Monnier
2002-07-19 14:16                                 ` Andreas Schwab
2002-07-19 15:04                                   ` Stefan Monnier
2002-07-19 16:54                           ` Richard Stallman
2002-07-19 17:48                             ` Ken Raeburn
2002-07-19 18:25                             ` Marius Vollmer
2002-07-20  0:35                               ` Richard Stallman
2002-07-20 12:00                                 ` Marius Vollmer
2002-07-21 20:14                                   ` Richard Stallman
2002-07-19 16:54                           ` Richard Stallman
2002-07-04 19:07             ` ehelp woes, or why I hate a module that I love so much Henrik Enberg
2002-07-05  0:49               ` Juanma Barranquero
2002-07-05 11:15                 ` Per Abrahamsen
2002-07-05 10:48             ` Richard Stallman

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=tx11ya0x14s.fsf@raeburn.org \
    --to=raeburn@raeburn.org \
    --cc=emacs-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.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

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