unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* why does `variable-at-point' return 0?
@ 2012-04-07  0:23 Drew Adams
  2012-04-16 18:07 ` Drew Adams
  0 siblings, 1 reply; 9+ messages in thread
From: Drew Adams @ 2012-04-07  0:23 UTC (permalink / raw)
  To: emacs-devel

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?




^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2012-04-21  2:24 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-04-07  0:23 why does `variable-at-point' return 0? Drew Adams
2012-04-16 18:07 ` Drew Adams
2012-04-19 19:50   ` Štěpán Němec
2012-04-19 21:28     ` Drew Adams
2012-04-19 21:52   ` Stefan Monnier
2012-04-19 22:56     ` Juanma Barranquero
2012-04-20 18:14     ` Štěpán Němec
2012-04-20 22:57       ` Juanma Barranquero
2012-04-21  2:24       ` Stefan Monnier

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).