GNU bug report logs - #7086
`booleanp' return value is multi-valued list

Previous Next

Package: emacs;

Reported by: MON KEY <monkey <at> sandpframing.com>

Date: Wed, 22 Sep 2010 21:56:01 UTC

Severity: minor

Tags: notabug

Done: Chong Yidong <cyd <at> stupidchicken.com>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: MON KEY <monkey <at> sandpframing.com>
To: 7086 <at> debbugs.gnu.org
Subject: bug#7086: `booleanp' return value is multi-valued list
Date: Wed, 22 Sep 2010 17:58:12 -0400
"Return non-`nil' if OBJECT is one of the two canonical boolean
 values: `t' or `nil'."

It should be documented both in the manual and the docstring of `booleanp' that
its return value is a list.

Specifically that the following two forms return muti-valued lists:

 (booleanp t)
 ;=> (t)

 (booleanp nil)
 ;=> (nil t)

Additionaly, given the nature of this function and the puposes it
might serve, it
should be documented _why_ the return value is a list.

Frustratingly, while the manual waxes on about the readers interpretation of
fundamental identity equivalence w/re `nil' and `()' and their self evaluating
specialness it has frightening little to offer w/re how one should reflect on
these things values within lisp programs.

    (info "(elisp)nil and t")

In lieu of this, the terseness of the `booleanp's docstring extends a
tautological
flavor which can only be met with confusion by the uninitiated.

Indeed, while I can appreciate why (booleanp nil) returns a two element list
I'm unable to reason a rationale for why (booleanp t) doesn't?

Also, there is this goofiness:

(defun tt--bool-w/opt (&optional x)
  (booleanp x))

(tt--bool-w/opt nil) ;=> (nil t)
(tt--bool-w/opt t)   ;=> (t)
(tt--bool-w/opt)     ;=> (nil t)

(defun tt--bool (x)
  (booleanp x))

(tt--bool nil)   ;=> (nil t)
(tt--bool t)     ;=> (t)
(tt--bool 'nil)  ;=> (nil t)
(booleanp '())   ;=> (nil t)
(booleanp ())    ;=> (nil t)

(tt--bool)
;=> Debugger entered--Lisp error:
; (wrong-number-of-arguments (lambda (x) (booleanp x)) 0)

Also, I find this above error troublesome given that the following
form returns:

(tt--bool-w/opt)

Whereas this one doesn't:

(defun tt--bool-nil (nil)
  (booleanp nil))

(tt--bool-nil)
;=> Debugger entered--Lisp error:
; (wrong-number-of-arguments (lambda (nil) (booleanp nil)) 0)

(tt--bool-nil 'nil)
;=> Debugger entered--Lisp error: (setting-constant nil)

And, the nature of the above errors doesn't really stand up given that:

(defun tt--bool-qt-nil (())
  (booleanp '()))

(tt--bool-qt-nil)
;=> Debugger entered--Lisp error: (wrong-number-of-arguments (lambda
(nil) (booleanp (quote nil))) 0)

(tt--bool-qt-nil nil)
;=> Debugger entered--Lisp error: (setting-constant nil)

(tt--bool-qt-nil ())
;=> Debugger entered--Lisp error: (setting-constant nil)

These last two being the most maddening.

Emacs lets me define the function but then accuses me of somthing I didn't even
(appear) to do, i.e. set the constant nil.

--
/s_P\




This bug report was last modified 14 years and 292 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.