From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: MON KEY Newsgroups: gmane.emacs.bugs Subject: bug#7086: `booleanp' return value is multi-valued list Date: Thu, 23 Sep 2010 00:22:18 -0400 Message-ID: References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Trace: dough.gmane.org 1285216875 27088 80.91.229.12 (23 Sep 2010 04:41:15 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Thu, 23 Sep 2010 04:41:15 +0000 (UTC) Cc: kevin.d.rodgers@gmail.com, 7086@debbugs.gnu.org To: Juanma Barranquero Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Sep 23 06:41:13 2010 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1OydcO-0004py-MV for geb-bug-gnu-emacs@m.gmane.org; Thu, 23 Sep 2010 06:41:12 +0200 Original-Received: from localhost ([127.0.0.1]:48322 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OydcO-0000bu-1s for geb-bug-gnu-emacs@m.gmane.org; Thu, 23 Sep 2010 00:41:12 -0400 Original-Received: from [140.186.70.92] (port=37803 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OydcE-0000bf-JH for bug-gnu-emacs@gnu.org; Thu, 23 Sep 2010 00:41:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OydcD-0001wh-3k for bug-gnu-emacs@gnu.org; Thu, 23 Sep 2010 00:41:02 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:49228) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OydcC-0001wc-WC for bug-gnu-emacs@gnu.org; Thu, 23 Sep 2010 00:41:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.69) (envelope-from ) id 1OydHv-0007X3-K4; Thu, 23 Sep 2010 00:20:03 -0400 X-Loop: help-debbugs@gnu.org Resent-From: MON KEY Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 23 Sep 2010 04:20:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 7086 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 7086-submit@debbugs.gnu.org id=B7086.128521558528942 (code B ref 7086); Thu, 23 Sep 2010 04:20:03 +0000 Original-Received: (at 7086) by debbugs.gnu.org; 23 Sep 2010 04:19:45 +0000 Original-Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OydHb-0007Wl-Uv for submit@debbugs.gnu.org; Thu, 23 Sep 2010 00:19:44 -0400 Original-Received: from mail-wy0-f172.google.com ([74.125.82.172]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OydHa-0007Wg-FA for 7086@debbugs.gnu.org; Thu, 23 Sep 2010 00:19:42 -0400 Original-Received: by wyi11 with SMTP id 11so1173399wyi.3 for <7086@debbugs.gnu.org>; Wed, 22 Sep 2010 21:22:18 -0700 (PDT) Original-Received: by 10.216.232.144 with SMTP id n16mr1004234weq.1.1285215738489; Wed, 22 Sep 2010 21:22:18 -0700 (PDT) Original-Received: by 10.216.67.195 with HTTP; Wed, 22 Sep 2010 21:22:18 -0700 (PDT) In-Reply-To: X-Google-Sender-Auth: 6QqvVytCORHlT-r0fHgopzkmkNo X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list Resent-Date: Thu, 23 Sep 2010 00:20:03 -0400 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:40366 Archived-At: On Wed, Sep 22, 2010 at 6:35 PM, Juanma Barranquero wrot= e: > On Wed, Sep 22, 2010 at 23:58, MON KEY wrote: > >> "Return non-`nil' if OBJECT is one of the two canonical boolean >> =C2=A0values: `t' or `nil'." >> >> It should be documented both in the manual and the docstring of `boolean= p' that >> its return value is a list. > > Why? It is a type predicate. If anything, it should be changed to > return t or nil, I'm pretty sure returning a single value is NTRT and can only generate confusion e.g.: (booleanp (booleanp "not-a-boolean")) ;=3D> t What I would suggest is the following behavior: (booleanp t) ;=3D> (t t) (booleanp nil) ;=3D> (nil t) (booleanp "not-a-boolean") ;=3D> (nil nil) Returning a two element list on success shares some similarity with Common Lisp's multiple values which seem pertinent for special cases like this one in that there is provision for reflection that is hard to obtain with a uni-valued return, e.g. Right now if I ask: (let ((query-truth (eq 8 3))) (car (booleanp query-truth))) ;=3D> nil it is hard to know if the thing being queried of was indeed a boolean. Whereas with a two element proper list: (let ((query-truth (eq 8 3))) (and (cadr (booleanp query-truth)) (not (car (booleanp query-truth))))) ;=3D> t We can be sure we got a boolean and that it was nil. -- /s_P\