unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: "Drew Adams" <drew.adams@oracle.com>
To: "'Stefan Monnier'" <monnier@iro.umontreal.ca>
Cc: emacs-devel@gnu.org
Subject: RE: Should nil COLLECTION element mean a "nil" candidate for completing-read? Alist doc.
Date: Tue, 21 Jul 2009 17:07:51 -0700	[thread overview]
Message-ID: <6BEC3A55E55C44CDB98BC4F58101851C@us.oracle.com> (raw)
In-Reply-To: <jwvws629gol.fsf-monnier+emacs@gnu.org>

> > What does that mean? Are you simply saying "don't do that" - users
> > must ensure that there are no nil elements in the COLLECTION arg?
> 
> Yes.

Too bad.

> > And what about the rest of my post, regarding the doc 
> > contradictions and
> > confusion wrt alist elements?
> 
> Same idea:
> 
> > The doc describing the COLLECTION arg to `completing-read',
> > `try-completion', etc. does not call out this special treatment of
> > nil.  In fact, it does not even say that you can mix cons 
> > entries and string entries (let alone nil entries).
> 
> Indeed, it doesn't say you can do it.  So if you do it, you're on
> your own.

The current behavior, which you apparently don't want to correct as a bug,
contradicts the behavior descibed by the doc. The doc says that alist treatment
ignores nil entries - and here it does not. Here nil is treated as if it were
the 3-character string "nil".

That special, undocumented behavior contradicts the existing doc. Based on the
doc, users have a right to expect nil elements in alists to be ignored. There is
nothing indicating that they should expect `completing-read' to treat nil as
"nil".

We are saying one thing and doing something quite different. Users of
`completing-read' have a right to a more faithful description of its behavior.
They shouldn't have to find out by trial and error how it treats certain
elements.

I propose that this be considered a bug (not a doc bug), and that it be fixed by
doing what the doc says: ignore nil entries. That will also simplify code -
users won't need to add extra code just to filter out nil or prevent its
inclusion. Currently, not only must such code be added, but it must be
commented, since this weird behavior that it works around isn't even documented.

The status quo is not good.





  reply	other threads:[~2009-07-22  0:07 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-21  3:20 Should nil COLLECTION element mean a "nil" candidate for completing-read? Alist doc Drew Adams
2009-07-21  3:40 ` Should nil COLLECTION element mean a "nil" candidate forcompleting-read? " Drew Adams
2009-07-21 15:48   ` Stefan Monnier
2009-07-22  0:07     ` Should nil COLLECTION element mean a "nil" candidateforcompleting-read? " Drew Adams
2009-07-22  3:15       ` Stefan Monnier
2009-07-21 13:23 ` Should nil COLLECTION element mean a "nil" candidate for completing-read? " Stefan Monnier
2009-07-21 14:51   ` Drew Adams
2009-07-21 15:55     ` Stefan Monnier
2009-07-22  0:07       ` Drew Adams [this message]
2009-07-22  3:24         ` Stefan Monnier
2009-07-28  4:26         ` Kevin Rodgers
2009-07-21 23:22   ` Johan Bockgård
2009-07-22  0:07     ` Should nil COLLECTION element mean a "nil" candidate forcompleting-read? " Drew Adams

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=6BEC3A55E55C44CDB98BC4F58101851C@us.oracle.com \
    --to=drew.adams@oracle.com \
    --cc=emacs-devel@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    /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).