unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: MON KEY <monkey@sandpframing.com>
Cc: 7086@debbugs.gnu.org
Subject: bug#7086: `booleanp' return value is multi-valued list
Date: Thu, 23 Sep 2010 10:12:28 +0200	[thread overview]
Message-ID: <83pqw4vpxv.fsf@gnu.org> (raw)
In-Reply-To: <AANLkTinm3u=qvJDd4Ncx8pyM0UZ26OzJirzyG3X2JeFn@mail.gmail.com>

> Date: Wed, 22 Sep 2010 17:58:12 -0400
> From: MON KEY <monkey@sandpframing.com>
> 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.





  parent reply	other threads:[~2010-09-23  8:12 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-22 21:58 bug#7086: `booleanp' return value is multi-valued list MON KEY
2010-09-22 22:35 ` Juanma Barranquero
2010-09-23  2:06   ` Kevin Rodgers
2010-09-23 10:29     ` Juanma Barranquero
2010-10-03  1:11     ` Chong Yidong
2010-09-23  4:22   ` MON KEY
2010-09-23 10:31     ` Juanma Barranquero
2010-09-23  8:12 ` Eli Zaretskii [this message]
2010-09-24  6:41   ` MON KEY
2010-09-24  8:48     ` Juanma Barranquero
2010-09-24  9:28     ` Lawrence Mitchell
2010-09-24 22:00 ` MON KEY
2010-09-25  9:18   ` Juanma Barranquero

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=83pqw4vpxv.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=7086@debbugs.gnu.org \
    --cc=monkey@sandpframing.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).