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

Re: #T, self-evaluation, and NULL-LIST =? FALSE.



    In T, #T and #F are external syntax for true and false *objects*, not
    *expressions*.  #T and #F are not themselves supposed to be evaluable
    expressions.  Evaluable expressions which give true and false values are
    T and NIL, or, if you prefer, (TRUE) and (FALSE).
    

However, note the following behavior:

   > (eq? (true) '#T)
   ()

What then is the purpose of #T (or equivalently the *TRUE-OBJECT*)?  I realize
the difference between #T and (TRUE), but I guess I was trying to say that
I didn't see the need for #T, given that we have (TRUE) (or T, if you prefer).
It just seemed like unnecessary syntax (shudder!) to me.

    In the long run I think the right thing to do is to somehow make the way
    that boolean and other objects evaluate (macroexpand) be a property of
    the syntax table...

Again, why do we need syntax for booleans when we have T, NIL, (TRUE) and (FALSE)?
    
                                      ... (it's bad enough that numbers
    self-evaluate; where does one draw the line?)...

I disagree.  The value of 34 is 34, not ERROR.

                                      ... (It would have helped if we
    had distinguished #F from () back in 1981 when we had a chance.)
    
We all use the fact that the null list and the false object are the same while
programming.  This isn't due to any theoretical confusion (any more than making
use of (CAR '()) => () is); it just happens to be convenient sugar for something
that occurs very often.  The sugar helps in avoiding code clutter which would
otherwise result from type checking all over the place.  In addition, I think
this also helps in defining the semantics of some functions, such as ASS.  Now
we can simply say that ASS returns a pair (which may be NIL if the key isn't
in the A-list) without worrying about whether "not being in the A-list" means
returning a NULL pair or the boolean FALSE.  Of course, the user can always
hand the result of ASS to (COND ((NULL? result) -not-found-) (ELSE -use-pair-)),
but then this gets us back to the code clutter point.

-- Ashwin.

-------