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: Fri, 24 Sep 2010 02:41:43 -0400 Message-ID: References: <83pqw4vpxv.fsf@gnu.org> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: dough.gmane.org 1285312278 20602 80.91.229.12 (24 Sep 2010 07:11:18 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Fri, 24 Sep 2010 07:11:18 +0000 (UTC) Cc: Juanma Barranquero , 7086@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Sep 24 09:11:16 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 1Oz2R8-0005Mv-AO for geb-bug-gnu-emacs@m.gmane.org; Fri, 24 Sep 2010 09:11:14 +0200 Original-Received: from localhost ([127.0.0.1]:53073 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Oz2R7-0007uZ-Es for geb-bug-gnu-emacs@m.gmane.org; Fri, 24 Sep 2010 03:11:13 -0400 Original-Received: from [140.186.70.92] (port=35333 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Oz2Qz-0007uU-L2 for bug-gnu-emacs@gnu.org; Fri, 24 Sep 2010 03:11:06 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1Oz2Qy-0005TP-Jp for bug-gnu-emacs@gnu.org; Fri, 24 Sep 2010 03:11:05 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:39465) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Oz2Qy-0005TL-IN for bug-gnu-emacs@gnu.org; Fri, 24 Sep 2010 03:11:04 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.69) (envelope-from ) id 1Oz1ww-0002Mh-Vt; Fri, 24 Sep 2010 02:40: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: 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 Original-Received: via spool by 7086-submit@debbugs.gnu.org id=B7086.12853103469078 (code B ref 7086); Fri, 24 Sep 2010 06:40:02 +0000 Original-Received: (at 7086) by debbugs.gnu.org; 24 Sep 2010 06:39:06 +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 1Oz1w2-0002MN-8r for submit@debbugs.gnu.org; Fri, 24 Sep 2010 02:39:06 -0400 Original-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 Original-Received: by wwj40 with SMTP id 40so2405198wwj.15 for <7086@debbugs.gnu.org>; Thu, 23 Sep 2010 23:41:43 -0700 (PDT) Original-Received: by 10.216.11.3 with SMTP id 3mr9091073wew.89.1285310503681; Thu, 23 Sep 2010 23:41:43 -0700 (PDT) Original-Received: by 10.216.67.195 with HTTP; Thu, 23 Sep 2010 23:41:43 -0700 (PDT) In-Reply-To: <83pqw4vpxv.fsf@gnu.org> X-Google-Sender-Auth: ugZJdFANDx7LbPywPAk6SMRrv5A X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list Resent-Date: Fri, 24 Sep 2010 02:40:02 -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:40390 Archived-At: 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)