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

disjointness of types

    I wholeheartedly supported adding NULL? to IEEE scheme; however, I would
    advocate going all the way.  Since we are currently drafting the first Scheme
    standard, we have the rare opportunity to rectify the traditional mistake of
    allowing '() to act as a boolean.  We should actually mandate the separation of
    these types NOW.  Once the first standard is produced, it will be too late to
    rectify this problem.  Forever after, people will strongly resist an
    incompatible change to the standard.


I object pretty strongly to requiring (eq? #f '()) -> #f.  I have two
main objections:

1) (Purely procedural) The RNRS "committee" has not accepted this, and
the standard should not be incompatible with it.  This is the wrong
forum to discuss this!

2) (Semantic) I think that the people who advocate for (eq? #f '()) ->
#f do so under a view of the world that is different from mine, but
neither better nor worse.  I will present mine, since the other side
has presented its own many times:

Lists in Lisp are a convention, not a type.  In particular, lists
always satisfy (at least) two predicates, either LIST? and PAIR?, or
LIST? and NULL?.  The main type out of which they are built is the
pair, yet not all pairs are lists.

Lists are defined by the property that if they are not empty, their
CDRs are lists as well, and a finite number of nested applications of
CDR will yield the empty list.

I need some object to distinguish the empty list which, by definition,
will satisfy the predicate NULL?.  This object has no other purpose in
life than to distinguish the empty list or end of a non-empty list,
and since it is the artifact of a convention, I should be able to
choose any object that I damn well please for this purpose, as long as
I use it consistently.

Thus I could choose the object 3, the object #t, the object 'NIL, the
object #f, or do the following:

(define empty-list
  (let ((pair (cons 'unknown 'unknown)))
    (set-car! pair pair)
    (set-car! pair pair)

Although I don't mind other people creating a distinct object only for
this convention, please don't force me to do the same!  I think it is
unnecessary and somewhat misguided.

Thus, I object strongly to requiring (eq? #f '()) -> #f 
I object as well to describing NULL? as a type predicate, with
the restrictions that type predicates have.