[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: why does `variable-at-point' return 0?
From: |
Drew Adams |
Subject: |
RE: why does `variable-at-point' return 0? |
Date: |
Mon, 16 Apr 2012 11:07:47 -0700 |
ping
> Just curious. Why doesn't `variable-at-point' return nil if
> there is no variable at point?
>
> All I can think of is that for some reason someone wanted to
> test using `symbolp' instead of testing using `not' (or `and').
> But I cannot imagine why.
>
> Checking how `variable-at-point' is actually used in the
> source code did not enlighten me. Each use just checks whether
> the value is `symbolp' and goes on from there. An actual value
> of zero is never used AFAICT, except to serve as a non-symbol.
>
> There is no special need to distinguish nil from any variable - in
> Emacs Lisp you cannot give the symbol nil a symbol-value other than nil.
>
> It is true that (boundp nil) is true, so `boundp' is not a
> test of variableness. But I don't see why it wouldn't be just as
> easy to test whether the value is nil instead of testing whether it
> is a symbol. What am I missing?