kawa-commonlisp-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Kawa-commonlisp-dev] Switching to Guile's #nil


From: John Cowan
Subject: [Kawa-commonlisp-dev] Switching to Guile's #nil
Date: Tue, 18 Jun 2013 11:18:42 -0400
User-agent: Mutt/1.5.20 (2009-06-14)

(Note:  In this post, by "Lisp" I mean Common Lisp or Elisp or ISLisp
or any other traditional Lisp, but not Scheme.)

FWIU, in Kawa the the Scheme equivalent of Lisp's NIL is the empty list.
I wanted to explore the possibility of adopting Guile's convention of
using a separate object notated #nil in Scheme.

The way #nil behaves is this:

1) In both Scheme and Lisp, it is false.

2) Both Scheme `null?` and Lisp `null` return true on it.

3) It is a symbol in Lisp but not in Scheme.

The advantages of this is promoting interoprerability between predicates.
As things stand, Scheme has to know that when it calls a Lisp predicate
it may get the empty list back, and lisp has to know that when it calls a
Scheme predicate it may get back some Scheme object that isn't even part
of the Lisp system (the value of scheme:false, or something like that).

The problem, of course, is the increased run-time cost.  In Guile, #t and
#f and #nil are all immediates, so a simple mask test works.  In Kawa
it would require two chained tests for both `null?` and (worse) truth
value, unless something clever can be done with classes and `instanceof`
(I don't know how slow that is).

What do people think?

(#nil could also serve the role of SQL null in a separate set of trivalent
logic operators, but that's by the way.)

-- 
You escaped them by the will-death              John Cowan
and the Way of the Black Wheel.                 address@hidden
I could not.  --Great-Souled Sam                http://www.ccil.org/~cowan



reply via email to

[Prev in Thread] Current Thread [Next in Thread]