[Top][All Lists]

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

bug#7086: `booleanp' return value is multi-valued list

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
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)

;=> 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:


Whereas this one doesn't:

(defun tt--bool-nil (nil)
  (booleanp 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 '()))

;=> 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.


reply via email to

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