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

From: Juanma Barranquero <[email-masked]>
Date: Thu, 23 Sep 2010 00:35:30 +0200

On Wed, Sep 22, 2010 at 23:58, MON KEY <[email-masked]> wrote:

> "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.

Why? It is a type predicate. If anything, it should be changed to
return t or nil, as "(elisp)2.6 Type Predicates" says:

     A type predicate function takes one argument; it returns `t' if the
  argument belongs to the appropriate type, and `nil' otherwise.

The fact that it returns nil or a list is an implementation detail.

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

Why do you expect any kind of rationale, other than the simple fact
that it is implemented as

  (memq object '(nil t)))

?

> Also, there is this goofiness:
[...]
> ; (wrong-number-of-arguments (lambda (x) (booleanp x)) 0)

What is exactly the goofiness?

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

Again, what did you expect?

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

Of course you did. Why do you expect to use `nil' as an argument and
not have trouble?

    Juanma