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: Juanma Barranquero <lekktu <at> gmail.com>
To: MON KEY <monkey <at> sandpframing.com>
Cc: 7086 <at> debbugs.gnu.org
Subject: bug#7086: `booleanp' return value is multi-valued list
Date: Thu, 23 Sep 2010 00:35:30 +0200
On Wed, Sep 22, 2010 at 23:58, MON KEY <monkey <at> sandpframing.com> 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




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

Previous Next


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