From unknown Sat Aug 16 19:17:05 2025 X-Loop: help-debbugs@gnu.org Subject: bug#7086: `booleanp' return value is multi-valued list 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: Wed, 22 Sep 2010 21:56:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 7086 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 7086@debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.128519254518545 (code B ref -1); Wed, 22 Sep 2010 21:56:01 +0000 Received: (at submit) by debbugs.gnu.org; 22 Sep 2010 21:55:45 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OyXI0-0004p4-Gm for submit@debbugs.gnu.org; Wed, 22 Sep 2010 17:55:44 -0400 Received: from eggs.gnu.org ([140.186.70.92]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OyXHy-0004oz-AQ for submit@debbugs.gnu.org; Wed, 22 Sep 2010 17:55:42 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OyXKT-0006IX-AJ for submit@debbugs.gnu.org; Wed, 22 Sep 2010 17:58:18 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE autolearn=unavailable version=3.3.1 Received: from lists.gnu.org ([199.232.76.165]:42421) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OyXKT-0006IQ-7x for submit@debbugs.gnu.org; Wed, 22 Sep 2010 17:58:17 -0400 Received: from [140.186.70.92] (port=51579 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OyXKR-000896-TH for bug-gnu-emacs@gnu.org; Wed, 22 Sep 2010 17:58:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OyXKQ-0006H2-DR for bug-gnu-emacs@gnu.org; Wed, 22 Sep 2010 17:58:15 -0400 Received: from mail-wy0-f169.google.com ([74.125.82.169]:59224) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OyXKQ-0006GO-9J for bug-gnu-emacs@gnu.org; Wed, 22 Sep 2010 17:58:14 -0400 Received: by wyb36 with SMTP id 36so1254769wyb.0 for ; Wed, 22 Sep 2010 14:58:13 -0700 (PDT) MIME-Version: 1.0 Received: by 10.216.138.65 with SMTP id z43mr735277wei.12.1285192692942; Wed, 22 Sep 2010 14:58:12 -0700 (PDT) Received: by 10.216.67.195 with HTTP; Wed, 22 Sep 2010 14:58:12 -0700 (PDT) Date: Wed, 22 Sep 2010 17:58:12 -0400 X-Google-Sender-Auth: KWwK1PgjXgRRoLGufAmq8e4wxbA Message-ID: From: MON KEY Content-Type: text/plain; charset=UTF-8 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-Spam-Score: -4.2 (----) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -5.1 (-----) "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\ From unknown Sat Aug 16 19:17:05 2025 X-Loop: help-debbugs@gnu.org Subject: bug#7086: `booleanp' return value is multi-valued list Resent-From: Juanma Barranquero Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 22 Sep 2010 22:34:02 +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: To: MON KEY Cc: 7086@debbugs.gnu.org Received: via spool by 7086-submit@debbugs.gnu.org id=B7086.128519482519595 (code B ref 7086); Wed, 22 Sep 2010 22:34:02 +0000 Received: (at 7086) by debbugs.gnu.org; 22 Sep 2010 22:33:45 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OyXsm-000560-TF for submit@debbugs.gnu.org; Wed, 22 Sep 2010 18:33:45 -0400 Received: from mail-iw0-f172.google.com ([209.85.214.172]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OyXsl-00055v-2Z for 7086@debbugs.gnu.org; Wed, 22 Sep 2010 18:33:43 -0400 Received: by iwn3 with SMTP id 3so825018iwn.3 for <7086@debbugs.gnu.org>; Wed, 22 Sep 2010 15:36:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:mime-version:received:in-reply-to :references:from:date:message-id:subject:to:cc:content-type :content-transfer-encoding; bh=H+2J8pVu1+rLc2u1pLd6BddnKBOPeyJuFpI3ZiY1F2c=; b=nXnZCni24eQnpJIVlU7LODBFv1YYpvqsMEYPowV20aYj1NCitTjsJJ2GEAr9h/lZCD UMq6ZPZ7GilBZsYvq8GLtMOf+q2jekYELfAw84A9Xx116Lrajt+dvgnc17vmnxtoG1Pc Gs3gXY6n/vvR0R4n3o6obBNmmIBrdTZ5j58OU= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type:content-transfer-encoding; b=UmL6+9mS6JckR3SqcmJodRTauRXCVXNFXAMrTAtXOdmN8U43hwB3JjnIAZiH5ADPbn hvzESkH/hvLi3eZJlA3zqrn9Pej7kXBynQdZqmP9zYq/jOzvgmpyOrRxSKvq1SnAlIIR UQyTnBqC5+kxqxgk4g/kYi2nqUIqSsOTHLDnk= Received: by 10.231.157.205 with SMTP id c13mr896287ibx.71.1285194971082; Wed, 22 Sep 2010 15:36:11 -0700 (PDT) MIME-Version: 1.0 Received: by 10.231.196.71 with HTTP; Wed, 22 Sep 2010 15:35:30 -0700 (PDT) In-Reply-To: References: From: Juanma Barranquero Date: Thu, 23 Sep 2010 00:35:30 +0200 Message-ID: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.7 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.7 (--) 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 `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 l= ist > 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) > ;=3D> 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? =C2=A0 =C2=A0 Juanma From unknown Sat Aug 16 19:17:05 2025 X-Loop: help-debbugs@gnu.org Subject: bug#7086: `booleanp' return value is multi-valued list Resent-From: Kevin Rodgers 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 02:04:01 +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: To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.128520742525695 (code B ref -1); Thu, 23 Sep 2010 02:04:01 +0000 Received: (at submit) by debbugs.gnu.org; 23 Sep 2010 02:03:45 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OybA1-0006gO-4E for submit@debbugs.gnu.org; Wed, 22 Sep 2010 22:03:45 -0400 Received: from eggs.gnu.org ([140.186.70.92]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Oyb9z-0006gJ-1h for submit@debbugs.gnu.org; Wed, 22 Sep 2010 22:03:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OybCU-0007Bk-B6 for submit@debbugs.gnu.org; Wed, 22 Sep 2010 22:06:19 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM, T_RP_MATCHES_RCVD, T_TO_NO_BRKTS_FREEMAIL autolearn=unavailable version=3.3.1 Received: from lists.gnu.org ([199.232.76.165]:34467) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OybCU-0007Bg-9D for submit@debbugs.gnu.org; Wed, 22 Sep 2010 22:06:18 -0400 Received: from [140.186.70.92] (port=38127 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OybCT-0006IZ-Ao for bug-gnu-emacs@gnu.org; Wed, 22 Sep 2010 22:06:18 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OybCR-0007B8-Mj for bug-gnu-emacs@gnu.org; Wed, 22 Sep 2010 22:06:17 -0400 Received: from lo.gmane.org ([80.91.229.12]:39725) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OybCR-00077u-Gr for bug-gnu-emacs@gnu.org; Wed, 22 Sep 2010 22:06:15 -0400 Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1OybCL-0005eY-D0 for bug-gnu-emacs@gnu.org; Thu, 23 Sep 2010 04:06:09 +0200 Received: from c-67-166-3-76.hsd1.co.comcast.net ([67.166.3.76]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 23 Sep 2010 04:06:09 +0200 Received: from kevin.d.rodgers by c-67-166-3-76.hsd1.co.comcast.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 23 Sep 2010 04:06:09 +0200 X-Injected-Via-Gmane: http://gmane.org/ From: Kevin Rodgers Date: Wed, 22 Sep 2010 20:06:02 -0600 Lines: 33 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: usenet@dough.gmane.org X-Gmane-NNTP-Posting-Host: c-67-166-3-76.hsd1.co.comcast.net User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.4; en-US; rv:1.9.2.9) Gecko/20100915 Thunderbird/3.1.4 In-Reply-To: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-Spam-Score: -5.6 (-----) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -5.6 (-----) On 9/22/10 4:35 PM, Juanma Barranquero wrote: > On Wed, Sep 22, 2010 at 23:58, MON KEY 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))) (and (memq object '(nil t)) t) would be better. -- Kevin Rodgers Denver, Colorado, USA From unknown Sat Aug 16 19:17:05 2025 X-Loop: help-debbugs@gnu.org Subject: bug#7086: `booleanp' return value is multi-valued list 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: To: Juanma Barranquero Cc: kevin.d.rodgers@gmail.com, 7086@debbugs.gnu.org Received: via spool by 7086-submit@debbugs.gnu.org id=B7086.128521558528942 (code B ref 7086); Thu, 23 Sep 2010 04:20:03 +0000 Received: (at 7086) by debbugs.gnu.org; 23 Sep 2010 04:19:45 +0000 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 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 Received: by wyi11 with SMTP id 11so1173399wyi.3 for <7086@debbugs.gnu.org>; Wed, 22 Sep 2010 21:22:18 -0700 (PDT) MIME-Version: 1.0 Received: by 10.216.232.144 with SMTP id n16mr1004234weq.1.1285215738489; Wed, 22 Sep 2010 21:22:18 -0700 (PDT) Received: by 10.216.67.195 with HTTP; Wed, 22 Sep 2010 21:22:18 -0700 (PDT) In-Reply-To: References: Date: Thu, 23 Sep 2010 00:22:18 -0400 X-Google-Sender-Auth: 6QqvVytCORHlT-r0fHgopzkmkNo Message-ID: From: MON KEY Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -3.1 (---) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -3.1 (---) 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\ From unknown Sat Aug 16 19:17:05 2025 X-Loop: help-debbugs@gnu.org Subject: bug#7086: `booleanp' return value is multi-valued list Resent-From: Eli Zaretskii 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 08:11:01 +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: notabug To: MON KEY Cc: 7086@debbugs.gnu.org Reply-To: Eli Zaretskii Received: via spool by 7086-submit@debbugs.gnu.org id=B7086.12852294373286 (code B ref 7086); Thu, 23 Sep 2010 08:11:01 +0000 Received: (at 7086) by debbugs.gnu.org; 23 Sep 2010 08:10:37 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Oygt3-0000qx-Mr for submit@debbugs.gnu.org; Thu, 23 Sep 2010 04:10:37 -0400 Received: from mtaout20.012.net.il ([80.179.55.166]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Oygt0-0000qs-Rh for 7086@debbugs.gnu.org; Thu, 23 Sep 2010 04:10:36 -0400 Received: from conversion-daemon.a-mtaout20.012.net.il by a-mtaout20.012.net.il (HyperSendmail v2007.08) id <0L9600100XEHT200@a-mtaout20.012.net.il> for 7086@debbugs.gnu.org; Thu, 23 Sep 2010 10:12:27 +0200 (IST) Received: from HOME-C4E4A596F7 ([77.127.203.3]) by a-mtaout20.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0L960012JXGOTF00@a-mtaout20.012.net.il>; Thu, 23 Sep 2010 10:12:25 +0200 (IST) Date: Thu, 23 Sep 2010 10:12:28 +0200 From: Eli Zaretskii In-reply-to: X-012-Sender: halo1@inter.net.il Message-id: <83pqw4vpxv.fsf@gnu.org> References: X-Spam-Score: -1.9 (-) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) > Date: Wed, 22 Sep 2010 17:58:12 -0400 > From: MON KEY > Cc: > > "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. The precise form of the return value is an implementation detail. Such details need not be documented. Are there any _real-life_ use cases where this matter? > Additionaly, given the nature of this function and the puposes it > might serve, it > should be documented _why_ the return value is a list. Implementation details don't need to be documented, unless they really matter to Lisp programs which use these APIs. > 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. The manual is not a guide to reflections. Please explain what is missing, exactly. > 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? Again, why is it important? > 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) See (info "(elisp)Argument List") for an instant enlightening: omitted optional arguments default to nil. > (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) Exactly! See the above node in the manual. But this has nothing to do with booleanp. > 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. Emacs gives you enough rope to hang yourself; don't do that, unless you mean it. From unknown Sat Aug 16 19:17:05 2025 X-Loop: help-debbugs@gnu.org Subject: bug#7086: `booleanp' return value is multi-valued list Resent-From: Juanma Barranquero 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 10:28:02 +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: notabug To: Kevin Rodgers Cc: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.12852376376923 (code B ref -1); Thu, 23 Sep 2010 10:28:02 +0000 Received: (at submit) by debbugs.gnu.org; 23 Sep 2010 10:27:17 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Oyj1J-0001nc-GL for submit@debbugs.gnu.org; Thu, 23 Sep 2010 06:27:17 -0400 Received: from eggs.gnu.org ([140.186.70.92]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Oyj1G-0001nW-EI for submit@debbugs.gnu.org; Thu, 23 Sep 2010 06:27:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1Oyj3m-00085z-MA for submit@debbugs.gnu.org; Thu, 23 Sep 2010 06:29:51 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,T_DKIM_INVALID autolearn=unavailable version=3.3.1 Received: from lists.gnu.org ([199.232.76.165]:56111) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Oyj3m-00085v-KJ for submit@debbugs.gnu.org; Thu, 23 Sep 2010 06:29:50 -0400 Received: from [140.186.70.92] (port=47871 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Oyj3l-0001CK-MN for bug-gnu-emacs@gnu.org; Thu, 23 Sep 2010 06:29:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1Oyj3k-00085J-JC for bug-gnu-emacs@gnu.org; Thu, 23 Sep 2010 06:29:49 -0400 Received: from mail-iw0-f169.google.com ([209.85.214.169]:35181) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Oyj3k-000857-FV for bug-gnu-emacs@gnu.org; Thu, 23 Sep 2010 06:29:48 -0400 Received: by iwn33 with SMTP id 33so2230575iwn.0 for ; Thu, 23 Sep 2010 03:29:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:mime-version:received:in-reply-to :references:from:date:message-id:subject:to:cc:content-type :content-transfer-encoding; bh=n/bTOvGOJI83KJBLJqX8Vw9SSol2mF8b8IeYpXN47ko=; b=N7NucM4U4mv2Uad9kFCsdukIucewnDfclNlFTrYqo999G7rSgvK1ykk5l6v9lI7DCT 4HRrSq0C/t7Qq0xgz28VJfTu8TGaWV6X2OQmoTUhxqUbsEHdjPvRJzln4oGqq09MZuE/ zpuHbamfJK1BRHn6SmOcF+fR4kr0tbsgGAU4U= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type:content-transfer-encoding; b=n9dx1F4Az6IDko6t3TEBP7UK/MOwk70mt7sFvQ6bcOU2c/9cc4s+PvSkKGq3GTnD6a M2mTdHRXHHtE4EdLUbRF2eaITyxf9k2AK4ZPwVbqzh+M2qhWWmFYQBcoXznR/xcfwnrQ zuK0MZppNJA2xwn7ed9rFKW9yk3Ri/ubjeyG8= Received: by 10.231.15.9 with SMTP id i9mr1883468iba.58.1285237787229; Thu, 23 Sep 2010 03:29:47 -0700 (PDT) MIME-Version: 1.0 Received: by 10.231.196.71 with HTTP; Thu, 23 Sep 2010 03:29:06 -0700 (PDT) In-Reply-To: References: From: Juanma Barranquero Date: Thu, 23 Sep 2010 12:29:06 +0200 Message-ID: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-Spam-Score: -4.4 (----) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -4.4 (----) On Thu, Sep 23, 2010 at 04:06, Kevin Rodgers wr= ote: > (and (memq object '(nil t)) > =C2=A0 =C2=A0 t) > > would be better. Yes, indeed. =C2=A0 =C2=A0 Juanma From unknown Sat Aug 16 19:17:05 2025 X-Loop: help-debbugs@gnu.org Subject: bug#7086: `booleanp' return value is multi-valued list Resent-From: Juanma Barranquero 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 10:30: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: notabug To: MON KEY Cc: kevin.d.rodgers@gmail.com, 7086@debbugs.gnu.org Received: via spool by 7086-submit@debbugs.gnu.org id=B7086.12852377766984 (code B ref 7086); Thu, 23 Sep 2010 10:30:03 +0000 Received: (at 7086) by debbugs.gnu.org; 23 Sep 2010 10:29:36 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Oyj3Y-0001ob-8V for submit@debbugs.gnu.org; Thu, 23 Sep 2010 06:29:36 -0400 Received: from mail-iw0-f172.google.com ([209.85.214.172]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Oyj3V-0001oV-2w for 7086@debbugs.gnu.org; Thu, 23 Sep 2010 06:29:33 -0400 Received: by iwn3 with SMTP id 3so1317741iwn.3 for <7086@debbugs.gnu.org>; Thu, 23 Sep 2010 03:32:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:mime-version:received:in-reply-to :references:from:date:message-id:subject:to:cc:content-type :content-transfer-encoding; bh=hKv3uD3JEjRiXOBZuFdc+9uRE7cNf0BfY9VzdM68xsI=; b=Lhrl2+kLSciGEh/GHWTBBWyXYal9ghdeuy0AH6MKRLVxku2H/o1MKGsg2NAO8f3vjw 0ZJIuXf0KnF0YedfNz3mUWORqf7R2xiUyVUp7zIkAcbLG8vrvqGbFXunYg2pa91y5Bd5 C31SuNBIBRilu4n8OdFl9zpEr2+j0RDFM7r9I= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type:content-transfer-encoding; b=nMwM4a7IxJHAvwW2ZBzf9q7PPIl4/izkSmi1lbFT5s9khuEVG42/itAGmN5LKnwj0O qG9ZXueIE228/omBUnKc69C+rktNQiEzNe/nIo0+FnTVPzb/jqIFaRUUtVTfK4v7uu0A 6mLnc225EoxsMyVYBK95i1iBYrDaGswIQfIMQ= Received: by 10.231.30.76 with SMTP id t12mr1777138ibc.161.1285237922095; Thu, 23 Sep 2010 03:32:02 -0700 (PDT) MIME-Version: 1.0 Received: by 10.231.196.71 with HTTP; Thu, 23 Sep 2010 03:31:21 -0700 (PDT) In-Reply-To: References: From: Juanma Barranquero Date: Thu, 23 Sep 2010 12:31:21 +0200 Message-ID: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.7 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.7 (--) On Thu, Sep 23, 2010 at 06:22, MON KEY wrote: > I'm pretty sure returning a single value is NTRT and can only generate > confusion e.g.: No. Returning a single value is what is *expected* of a type predicate in Emacs Lisp, and so far it hasn't apparently generated any confusion. =C2=A0 =C2=A0 Juanma From unknown Sat Aug 16 19:17:05 2025 X-Loop: help-debbugs@gnu.org Subject: bug#7086: `booleanp' return value is multi-valued list 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: Fri, 24 Sep 2010 06:40:02 +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: notabug To: Eli Zaretskii Cc: Juanma Barranquero , 7086@debbugs.gnu.org Received: via spool by 7086-submit@debbugs.gnu.org id=B7086.12853103469078 (code B ref 7086); Fri, 24 Sep 2010 06:40:02 +0000 Received: (at 7086) by debbugs.gnu.org; 24 Sep 2010 06:39:06 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Oz1w2-0002MN-8r for submit@debbugs.gnu.org; Fri, 24 Sep 2010 02:39:06 -0400 Received: from mail-ww0-f46.google.com ([74.125.82.46]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Oz1w0-0002M1-Qi for 7086@debbugs.gnu.org; Fri, 24 Sep 2010 02:39:05 -0400 Received: by wwj40 with SMTP id 40so2405198wwj.15 for <7086@debbugs.gnu.org>; Thu, 23 Sep 2010 23:41:43 -0700 (PDT) MIME-Version: 1.0 Received: by 10.216.11.3 with SMTP id 3mr9091073wew.89.1285310503681; Thu, 23 Sep 2010 23:41:43 -0700 (PDT) Received: by 10.216.67.195 with HTTP; Thu, 23 Sep 2010 23:41:43 -0700 (PDT) In-Reply-To: <83pqw4vpxv.fsf@gnu.org> References: <83pqw4vpxv.fsf@gnu.org> Date: Fri, 24 Sep 2010 02:41:43 -0400 X-Google-Sender-Auth: ugZJdFANDx7LbPywPAk6SMRrv5A Message-ID: From: MON KEY Content-Type: text/plain; charset=UTF-8 X-Spam-Score: -2.2 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -3.1 (---) On Thu, Sep 23, 2010 at 4:12 AM, Eli Zaretskii wrote: > > The precise form of the return value is an implementation detail. > Such details need not be documented. > > Are there any _real-life_ use cases where this matter? > Probably none in the life of an Emacs devel. Though down here in the reified mud of consequence when Emacs prompts that some file variable doesn't satisfy booleanp it would be nice to know that the predicate was homoiconic. Whatever. (info "(elisp)File Local Variables") ,---- | You can specify safe values for a variable with a | `safe-local-variable' property. The property has to be a function of | one argument; any value is safe if the function returns non-`nil' given | that value. Many commonly-encountered file variables have | `safe-local-variable' properties; these include `fill-column', | `fill-prefix', and `indent-tabs-mode'. For boolean-valued variables | that are safe, use `booleanp' as the property value. Lambda | expressions should be quoted so that `describe-variable' can display | the predicate. `---- > > Implementation details don't need to be documented, unless they really > matter to Lisp programs which use these APIs. > This one matters. It is the penultimate Emacs lisp predicate. It tests for a boolean value yet it returns a list. > > Please explain what is missing, exactly. > I did. The return values should be either one of: t | nil or (my preference): (t t) | (nil t) Returning two different length lists for a predicate that interrogates a boolean is ill conceived. > > Again, why is it important? > How can it not be? >> 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) > > See (info "(elisp)Argument List") for an instant enlightening: omitted > optional arguments default to nil. > Oh, now I get it. - Omitted optional arguments default to nil; - and nil evaluates to itself; - the empty list is identical to nil; - and interrogating the constant with a predicate returns a list... - of length (length (booleanp nil)) => 2 - unless its of length (length (booleanp t)) => 1 Yep, crystal clear. >> (defun tt--bool (x) >> (booleanp x)) > {...} > Exactly! See the above node in the manual. > > But this has nothing to do with booleanp. It has everything to do with it. These are just the types of situations where interrogating a boolean is what is wanted. > > Emacs gives you enough rope to hang yourself; don't do that, unless > you mean it. > Its a horrible metaphor. That's not rope its Emacs' leash which it drags along so someone can always drag it back out of the mire: (defun booleanp (object) (or (and (eq object t) '(t t)) (and (eq object nil) '(nil t)))) (booleanp "bubba") ;=> nil (booleanp t) ;=> (t t) (booleanp nil) ;=> (nil t) (booleanp ()) ;=> (nil t) From unknown Sat Aug 16 19:17:05 2025 X-Loop: help-debbugs@gnu.org Subject: bug#7086: `booleanp' return value is multi-valued list Resent-From: Juanma Barranquero Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 24 Sep 2010 08:47:02 +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: notabug To: MON KEY Cc: Eli Zaretskii , 7086@debbugs.gnu.org Received: via spool by 7086-submit@debbugs.gnu.org id=B7086.128531798212055 (code B ref 7086); Fri, 24 Sep 2010 08:47:02 +0000 Received: (at 7086) by debbugs.gnu.org; 24 Sep 2010 08:46:22 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Oz3vB-00038O-9j for submit@debbugs.gnu.org; Fri, 24 Sep 2010 04:46:21 -0400 Received: from mail-iw0-f172.google.com ([209.85.214.172]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Oz3vA-00038J-0D for 7086@debbugs.gnu.org; Fri, 24 Sep 2010 04:46:20 -0400 Received: by iwn3 with SMTP id 3so2153743iwn.3 for <7086@debbugs.gnu.org>; Fri, 24 Sep 2010 01:48:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:mime-version:received:in-reply-to :references:from:date:message-id:subject:to:cc:content-type :content-transfer-encoding; bh=Xk8kZn0oYpdYmh0Izqw7DxFvaEe5Zx7BxEGYAc65Wk4=; b=kD5i2VhGcvVw9pWhxAq0Kz5vW2mq1Ax2luZAN1uSTSU4W8e/1vL0b8PB5NBm3p5M0l 6wtNmZiuExhyoLpF4MplPW+BPX+YgzlF6qBMJU6KnDCwdxSuF85bH9h0IA+viM5M/7Ov YMgZyYwKMCL6HRkT+jRO+2EFcSMSr4eV6a8uM= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type:content-transfer-encoding; b=id54WmxdJJB2/nTjN384yS1EbXnVq1PsqmvM3EDvg68ufgSdkDBir8utSgmlie0A23 5TI2pLLYw3zq4qio/mW/x6BIhVqxsSNKrOWYdS73nqcTFSOb+g1ikYcWNdu0KkXJ+fnP QKWI9M4HyKh/S13KotN7PL+4NlB3hF4FzxOrE= Received: by 10.231.173.9 with SMTP id n9mr3446942ibz.146.1285318139355; Fri, 24 Sep 2010 01:48:59 -0700 (PDT) MIME-Version: 1.0 Received: by 10.231.196.71 with HTTP; Fri, 24 Sep 2010 01:48:18 -0700 (PDT) In-Reply-To: References: <83pqw4vpxv.fsf@gnu.org> From: Juanma Barranquero Date: Fri, 24 Sep 2010 10:48:18 +0200 Message-ID: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.7 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.7 (--) On Fri, Sep 24, 2010 at 08:41, MON KEY wrote: > I did. The return values should be either one of: > > =C2=A0t | nil Yes. =C2=A0 =C2=A0 Juanma From unknown Sat Aug 16 19:17:05 2025 X-Loop: help-debbugs@gnu.org Subject: bug#7086: `booleanp' return value is multi-valued list In-Reply-To: Resent-From: Lawrence Mitchell Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 24 Sep 2010 09:27:01 +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: notabug To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.128532041412962 (code B ref -1); Fri, 24 Sep 2010 09:27:01 +0000 Received: (at submit) by debbugs.gnu.org; 24 Sep 2010 09:26:54 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Oz4YP-0003N1-Lf for submit@debbugs.gnu.org; Fri, 24 Sep 2010 05:26:54 -0400 Received: from eggs.gnu.org ([140.186.70.92]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Oz4YN-0003Mw-Kz for submit@debbugs.gnu.org; Fri, 24 Sep 2010 05:26:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1Oz4aw-0003qh-DB for submit@debbugs.gnu.org; Fri, 24 Sep 2010 05:29:31 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM, T_RP_MATCHES_RCVD, T_TO_NO_BRKTS_FREEMAIL autolearn=unavailable version=3.3.1 Received: from lists.gnu.org ([199.232.76.165]:56132) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Oz4aw-0003qd-23 for submit@debbugs.gnu.org; Fri, 24 Sep 2010 05:29:30 -0400 Received: from [140.186.70.92] (port=33560 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Oz4au-00010f-EJ for bug-gnu-emacs@gnu.org; Fri, 24 Sep 2010 05:29:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1Oz4as-0003qK-VO for bug-gnu-emacs@gnu.org; Fri, 24 Sep 2010 05:29:28 -0400 Received: from lo.gmane.org ([80.91.229.12]:54635) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Oz4as-0003qE-Op for bug-gnu-emacs@gnu.org; Fri, 24 Sep 2010 05:29:26 -0400 Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1Oz4ar-0003MW-6L for bug-gnu-emacs@gnu.org; Fri, 24 Sep 2010 11:29:25 +0200 Received: from garnet.epcc.ed.ac.uk ([129.215.56.222]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 24 Sep 2010 11:29:25 +0200 Received: from wence by garnet.epcc.ed.ac.uk with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 24 Sep 2010 11:29:25 +0200 X-Injected-Via-Gmane: http://gmane.org/ From: Lawrence Mitchell Date: Fri, 24 Sep 2010 10:28:41 +0100 Lines: 52 Message-ID: References: <83pqw4vpxv.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Complaints-To: usenet@dough.gmane.org X-Gmane-NNTP-Posting-Host: garnet.epcc.ed.ac.uk User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (usg-unix-v) Cancel-Lock: sha1:I4gcTJ5IO640+n1Vumk0AH0ly5s= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-Spam-Score: -5.4 (-----) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -5.5 (-----) MON KEY wrote: > This one matters. It is the penultimate Emacs lisp predicate. > It tests for a boolean value yet it returns a list. Which you can happily dispatch on: (if (booleanp foo) (if (null foo) (do-something-if-foo-is-nil) (do-something-if-foo-is-t)) (do-something-if-foo-is-neither-nil-nor-t)) It's hard to see what else is required [...] > On Thu, Sep 23, 2010 at 4:12 AM, Eli Zaretskii wrote: [...] MON KEY claims that (funcall (lambda (x) (booleanp x))) giving an error is somehow problematic. >> Exactly! See the above node in the manual. >> But this has nothing to do with booleanp. > It has everything to do with it. These are just the types of > situations where interrogating a boolean is what is wanted. What? (funcall (lambda (x) (1+ x))) => (wrong-number-of-arguments (lambda (x) (1+ x)) 0) (funcall (lambda (x) (booleanp x))) => (wrong-number-of-arguments (lambda (x) (booleanp x)) 0) Calling a function expecting an argument without one is an error, irrespective of the function involved. Do you in fact want: (require 'cl) (defun* foo (&optional (x nil got-x-p)) (if got-x-p (do-something-if-x-was-an-argument x) (do-something-different))) [...] -- Lawrence Mitchell From unknown Sat Aug 16 19:17:05 2025 X-Loop: help-debbugs@gnu.org Subject: bug#7086: `booleanp' return value is multi-valued list References: In-Reply-To: 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: Fri, 24 Sep 2010 21:58:02 +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: notabug To: 7086@debbugs.gnu.org Received: via spool by 7086-submit@debbugs.gnu.org id=B7086.12853654695845 (code B ref 7086); Fri, 24 Sep 2010 21:58:02 +0000 Received: (at 7086) by debbugs.gnu.org; 24 Sep 2010 21:57:49 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OzGH6-0001WE-Sh for submit@debbugs.gnu.org; Fri, 24 Sep 2010 17:57:49 -0400 Received: from mail-ww0-f46.google.com ([74.125.82.46]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OzGH4-0001W7-Nc for 7086@debbugs.gnu.org; Fri, 24 Sep 2010 17:57:47 -0400 Received: by wwb13 with SMTP id 13so104303wwb.15 for <7086@debbugs.gnu.org>; Fri, 24 Sep 2010 15:00:26 -0700 (PDT) MIME-Version: 1.0 Received: by 10.216.193.195 with SMTP id k45mr3286964wen.32.1285365626120; Fri, 24 Sep 2010 15:00:26 -0700 (PDT) Received: by 10.216.67.195 with HTTP; Fri, 24 Sep 2010 15:00:26 -0700 (PDT) Date: Fri, 24 Sep 2010 18:00:26 -0400 X-Google-Sender-Auth: EdRPfwddvT4hrX7NDBVhyBA5x50 Message-ID: From: MON KEY Content-Type: text/plain; charset=UTF-8 X-Spam-Score: -1.8 (-) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -3.1 (---) Lawrence Mitchell >> This one matters. It is the penultimate Emacs lisp predicate. >> It tests for a boolean value yet it returns a list. > Which you can happily dispatch on: > > (if (booleanp foo) > (if (null foo) > (do-something-if-foo-is-nil) > (do-something-if-foo-is-t)) > (do-something-if-foo-is-neither-nil-nor-t)) Not happliy if happiness means employing nested ifs conditioned on the variadic return value of a boolean. > It's hard to see what else is required. Not much, besides not having to reinvestigate the boolean status of foo repeatedly... The version of `booleanp' supplied at the bottom of this message does what I think is expected. My point is, your example illustrates a single branch where the return value of `booleanp' isn't cached away in some local var. There are certainly situations where holding onto that value for subsequent interrogation later is desired. With your example one is required to repeat the idiom: (if (booleanp foo) (if (null foo) {...} )) What I am suggesting is that in many situations where one wants to know if the value of foo is boolean it is often desired to reexamine that value more than once either in the same form or enclosing environment. So, it makes sense (and is cleaner than the repeated branching) to store `booleanp's return value a local var for later (re)examintation, also by storing foo in a local variable we can pass its _state_ around as data However with regards the latter, doing it cleanly requires that `booleanp' return a list with a consistent form for all possible states of foo; `t', `nil', and not-a-boolean. Which FWIW is the "reflection" i was referred to earlier though apparently Eli mistook this to be of the navel gazing type. As it is now with `booleanp's current multivariant return values: { (t) | (nil t) | nil } even when we cache the value it is still required to deconstruct the list elements imediately because it is unreasonable to delay taking the car of (nil t) in lieu of some later check for (null foo) because foo might've changed since then. Which BTW is why your solution imediately (re)investigates foo just after interrogating it. IOW, as currently configured no matter what the return value of `booleanp' subsequent "dispatching" still requires the data that `booleanp' returned your (null foo) being an illustrative case. Changing booleanp to consistently return a two elt list for each of its three possible results would address this and is a much better solution than requiring all callers to repeatedly (re)xamine foo just to parse/verify the junk booleanp currently throws out. > Calling a function expecting an argument without one is an error, Your missing my point. W/re `booleanp' how the function call occurs is irrelevant. The error isn't calling the function without an arg, the locus of the error was that the interpreter evaluated the form _without_ signalling. (defun tt--bool-nil (()) (booleanp ())) (disassemble 'tt--bool-nil) ;=> Debugger entered--Lisp error: (error "Compilation failed") (defun tt--not-gonna #(x) x) ;=> Debugger entered--Lisp error: (invalid-read-syntax "#") > irrespective of the function involved. Why do you assume the call will happen as a function and not instead inside of or as a macro, or in a closed over lexical environ on the heap, is delayed, etc.? Which is what I am suggesting with: "These are just the types of situations where interrogating a boolean is what is wanted." > Do you in fact want: > (require 'cl) Well, even when in fact i do, the byte-compiler would protest that in fact what I wanted was: (eval-when-compile (require 'cl)) Besides, the cl.el package is certainly not a panacea here given the lack of multiple value return. This said, following is what is wanted: (defun new-booleanp (putative-boolean) (or (and (eq putative-boolean t) '(t t)) (and (eq putative-boolean nil) '(nil t)) '(nil nil))) (defun multiple-booleanp (obj) (values-list (new-booleanp obj))) (multiple-booleanp t) ;=> t, t (multiple-booleanp nil) ;=> t, nil (multiple-booleanp "bubba") ;=> nil, nil And barring the cold chance in hell that Emacs will ever return multiple values I'd settle for: (multiple-booleanp t) ;=> (t t) (multiple-booleanp nil) ;=> (t nil) (multiple-booleanp "bubba") ;=> (nil nil) > Lawrence Mitchell -- /s_P\ From unknown Sat Aug 16 19:17:05 2025 X-Loop: help-debbugs@gnu.org Subject: bug#7086: `booleanp' return value is multi-valued list Resent-From: Juanma Barranquero Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 25 Sep 2010 09:17:02 +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: notabug To: MON KEY Cc: 7086@debbugs.gnu.org Received: via spool by 7086-submit@debbugs.gnu.org id=B7086.128540622023595 (code B ref 7086); Sat, 25 Sep 2010 09:17:02 +0000 Received: (at 7086) by debbugs.gnu.org; 25 Sep 2010 09:17:00 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OzQsO-00068W-9v for submit@debbugs.gnu.org; Sat, 25 Sep 2010 05:17:00 -0400 Received: from mail-iw0-f172.google.com ([209.85.214.172]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OzQsL-00068R-0H for 7086@debbugs.gnu.org; Sat, 25 Sep 2010 05:16:57 -0400 Received: by iwn3 with SMTP id 3so2984359iwn.3 for <7086@debbugs.gnu.org>; Sat, 25 Sep 2010 02:19:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:mime-version:received:in-reply-to :references:from:date:message-id:subject:to:cc:content-type :content-transfer-encoding; bh=4JW+8E8SKjsHBpIj2d/jp2kIeEgdMHsgN7UHj4fyvFo=; b=vuqvhBpNQ4ytvo5vK6Blypxb6iwFcDM8YdQ0YFpD+22qXVxTKBPW8JDxsaZjnb7n3B UmJX/i9aWZ1BpBfhZiH0oWjPpw/HpVhYbg1pji9ibFcO89v43grcELYhBJHKyaohx4vL DGKUtl4yFhMNmi1pjlAaMSPiRZnKd2jDpJiZE= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type:content-transfer-encoding; b=nayFExbe9nIRMESL4Am41rAg1nNeop7J/+jC8r5ZwtjEr/EJ2iaIHbDwsMLjcxWEpk 3IKH7z8HQqfCilb7ndFHXsgrWbJxlPwCFnne8d6Vk6xIMjzyLveiQSo5vSrtDzn23q40 ik0VrNW5g/me4mhR4NNDJerjQTujNxedq2sA8= Received: by 10.231.173.3 with SMTP id n3mr5262814ibz.56.1285406378980; Sat, 25 Sep 2010 02:19:38 -0700 (PDT) MIME-Version: 1.0 Received: by 10.231.196.71 with HTTP; Sat, 25 Sep 2010 02:18:58 -0700 (PDT) In-Reply-To: References: From: Juanma Barranquero Date: Sat, 25 Sep 2010 11:18:58 +0200 Message-ID: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.7 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.7 (--) On Sat, Sep 25, 2010 at 00:00, MON KEY wrote: > (defun new-booleanp (putative-boolean) > =C2=A0(or (and (eq putative-boolean t) '(t t)) > =C2=A0 =C2=A0 =C2=A0(and (eq putative-boolean nil) '(nil t)) > =C2=A0 =C2=A0 =C2=A0'(nil nil))) But this is not an Emacs Lisp type predicate, it's a new function with a very specific functionality. It is perhaps useful, but certainly as a different function. For one, if the stock `booleanp' worked as you suggest, it could not be used in its main uses right now (as :type in a defcustom and as 'safe-local-variable property value). Again: the fact that the current `booleanp' returns a "multivalued list" (not really, but still) is just an unfortunate implementation detail. The best way to deal with this bug is implement Kevin's suggestion (i.e., make booleanp into "(and (memq object '(nil t)) t)") so it follows the docs, and for you to open a new wishlist bug with your proposed new function. =C2=A0 =C2=A0 Juanma From unknown Sat Aug 16 19:17:05 2025 X-Loop: help-debbugs@gnu.org Subject: bug#7086: `booleanp' return value is multi-valued list Resent-From: Chong Yidong Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 03 Oct 2010 01:09:02 +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: notabug To: Kevin Rodgers Cc: 7086@debbugs.gnu.org Received: via spool by 7086-submit@debbugs.gnu.org id=B7086.12860681303092 (code B ref 7086); Sun, 03 Oct 2010 01:09:02 +0000 Received: (at 7086) by debbugs.gnu.org; 3 Oct 2010 01:08:50 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1P2D4M-0000np-HJ for submit@debbugs.gnu.org; Sat, 02 Oct 2010 21:08:50 -0400 Received: from pantheon-po24.its.yale.edu ([130.132.50.118]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1P2D4K-0000nk-RG for 7086@debbugs.gnu.org; Sat, 02 Oct 2010 21:08:49 -0400 Received: from furry (173-9-75-145-NewEngland.hfc.comcastbusiness.net [173.9.75.145]) (authenticated bits=0) by pantheon-po24.its.yale.edu (8.12.11.20060308/8.12.11) with ESMTP id o931BoXL013636 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Sat, 2 Oct 2010 21:11:51 -0400 Received: by furry (Postfix, from userid 1000) id 82161C018; Sat, 2 Oct 2010 21:11:50 -0400 (EDT) From: Chong Yidong References: Date: Sat, 02 Oct 2010 21:11:50 -0400 In-Reply-To: (Kevin Rodgers's message of "Wed, 22 Sep 2010 20:06:02 -0600") Message-ID: <87tyl4gjvt.fsf@stupidchicken.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-YaleITSMailFilter: Version 1.2c (attachment(s) not renamed) X-Spam-Score: -2.7 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.7 (--) Kevin Rodgers writes: > (and (memq object '(nil t)) > t) > > would be better. I've checked the change you suggested into the trunk. Thanks. From debbugs-submit-bounces@debbugs.gnu.org Sat Oct 02 21:09:07 2010 Received: (at control) by debbugs.gnu.org; 3 Oct 2010 01:09:07 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1P2D4c-0000oL-MZ for submit@debbugs.gnu.org; Sat, 02 Oct 2010 21:09:06 -0400 Received: from pantheon-po26.its.yale.edu ([130.132.50.121]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1P2D4b-0000nw-Ar for control@debbugs.gnu.org; Sat, 02 Oct 2010 21:09:05 -0400 Received: from furry (173-9-75-145-NewEngland.hfc.comcastbusiness.net [173.9.75.145]) (authenticated bits=0) by pantheon-po26.its.yale.edu (8.12.11.20060308/8.12.11) with ESMTP id o931C73L010600 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT) for ; Sat, 2 Oct 2010 21:12:07 -0400 Received: by furry (Postfix, from userid 1000) id EE51FC018; Sat, 2 Oct 2010 21:12:06 -0400 (EDT) From: Chong Yidong To: control@debbugs.gnu.org Subject: close 7086 Date: Sat, 02 Oct 2010 21:12:06 -0400 Message-ID: <87tyl49j15.fsf@stupidchicken.com> MIME-Version: 1.0 Content-Type: text/plain X-YaleITSMailFilter: Version 1.2c (attachment(s) not renamed) X-Spam-Score: -2.6 (--) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.6 (--) close 7086 thanks