From: Mark H Weaver <mhw@netris.org>
To: Andy Wingo <wingo@pobox.com>
Cc: guile-devel <guile-devel@gnu.org>
Subject: Re: guile and elisp
Date: Sat, 27 Mar 2010 09:07:51 -0400 [thread overview]
Message-ID: <20100327130750.GA9026@fibril.netris.org> (raw)
In-Reply-To: <m3bpectwu6.fsf@pobox.com>
Hello all,
I still haven't found the time to fully evaluate all of these thorny
issues regarding nil, nor to present my perspectives as persuasively
as I'd like to. Nonetheless I've thought about this issue a great
deal, and here are my thoughts:
First of all, we need to distinguish the equality predicates from the
values themselves. It is very important to unify the values from lisp
and scheme, but the equality predicates needn't be unified, and imho
shouldn't be.
In my view, the best way to think of "nil" in guile is: "either #f or
'(), but we don't know which one", rather than as a distinct value in
its own right. Almost every other language treats those two concepts
as distinct, and needs to be able to tell the difference between them
in order to implement its semantics properly. In other words, every
"nil" is ambiguous from the point of view of other languages.
I think it's very important that we choose a path which can
potentially lead to clean semantics somewhere down the road in a
future guile-emacs universe with finely intermixed scheme and lisp
code (and other languages for that matter).
So what is the path to clean semantics that I'd like to make available
to future generations of guile-emacs? I'd like it to be possible to
gradually convert instances of nil to either #f or '(), with the goal
of eventually deprecating nil altogether. We can think of this
process as "annotating" otherwise ambiguous values, so that non-lisp
languages know how to treat them. To enable that, we must be able
convert any instance of nil to #f or '() without breaking existing
lisp code. The way to accomplish this is to have different equality
predicates.
The Lisp equality predicates, and the associated hash tables, alists,
etc, should not distinguish boolean-false and end-of-list (and here's
the important point) regardless of where the values being
compared/hashed came from. The hacks involving intransitive equality
predicates only work when nil is used; they won't work reliably when
there is non-lisp code involved, nor if any of the aforementioned
annotation has been done.
The Scheme equality predicates should probably treat nil as Andy
proposes. There is no clean way to handle "nil" in a language which
distinguishes the two concepts that lisp conflates, but Andy's
proposal is the best one I've heard. Other non-lisp languages should
probably use similiar heuristics to deal with nil.
In addition, we might want to consider some kind of hacks to
automatically annotate data in various places. We could provide
procedures such as "canonicalize-boolean" which converts nil to #f,
and "canonicalize-list" which converts nil to '() and mutates any nil
in the CDRs to '().
These procedures could be safely called on values which are known to
be of the corresponding types, because semantically, they are only
adding information to what would otherwise be an ambiguous value.
This is only possible if Lisp treats #f, '() and nil as the same
value.
What do you think?
Mark
next prev parent reply other threads:[~2010-03-27 13:07 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-03-25 12:22 guile and elisp Andy Wingo
2010-03-27 13:07 ` Mark H Weaver [this message]
2010-03-27 16:54 ` Andy Wingo
2010-03-27 18:01 ` Mark H Weaver
2010-03-28 12:13 ` Andy Wingo
2010-03-29 8:42 ` Ludovic Courtès
2010-03-29 10:43 ` Andy Wingo
2010-03-29 12:01 ` Ludovic Courtès
2010-03-29 18:32 ` Grant Rettke
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=20100327130750.GA9026@fibril.netris.org \
--to=mhw@netris.org \
--cc=guile-devel@gnu.org \
--cc=wingo@pobox.com \
/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).