emacs-devel
[Top][All Lists]
Advanced

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

why does `variable-at-point' return 0?


From: Drew Adams
Subject: why does `variable-at-point' return 0?
Date: Fri, 6 Apr 2012 17:23:07 -0700

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?




reply via email to

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