all messages for Emacs-related lists mirrored at yhetil.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" candidateforcompleting-read? Alist doc.
Date: Tue, 21 Jul 2009 17:07:53 -0700	[thread overview]
Message-ID: <491580B15C204D059258DF3BD7740465@us.oracle.com> (raw)
In-Reply-To: <jwv8wiiavkb.fsf-monnier+emacs@gnu.org>

> > I forgot to point out that treating nil this way can lead to extra
> > (ugly) code, just to remove or prevent production of such 
> > nil entries,
> > so they are not available to the user.
> 
> A completion table can be a list of strings, a list of conses 
> where the car is a string, an obarry, a hashtable, or a function.
> Your "table" is none of those, so it's invalid.  Adding
> (delq nil ...)  before passing that table to the completion
> functions doesn't seem like a big issue.

First, it's not "my table". ;-)

More importantly:

1. Adding `delq' means a separate pass over the list (which can be big).
Preventing inclusion of nil, as an alternative, requires uglier, less clear code
(e.g. code that pushes an element to the list when it is non-nil).

2. Saying that users can do that as a workaround ("y'a qu'a") is a cop-out. This
is not documented - it's simply a gotcha. Users won't even know they must do
that, except through accidental discovery by trial and error (which is how I
discovered it). It is all too easy to create a list that might have some
extraneous nil elements - and not even be aware of them. Hence, this is also
error-prone.

> > IOW, I suspect that the number of times where this 
> > "feature" might be useful (for what?) is less than
> > the number of times where it is a nuisance.
> 
> It's not a feature.

Right; it's a bug - a regression wrt Emacs 21, in fact (you admit it wasn't
added intentionally, as a feature, and it is a user-visible change in behavior).
It is undocumented behavior that contradicts the documented behavior. The
general doc for alists says that nil entries will be ignored. Exceptions to that
should be documented.

You want to neither fix the code (so it will ignore nil entries) nor document
this change in behavior (since Emacs 21). That's not right.

I pose the questions: Should nil be ignored here? Should nil be treated like the
string "nil" here? Those are "should" questions. It's not sufficient to avoid a
response and take the view that the behavior is what it is and should not be
documented. I'm asking what the behavior _should_ be. And the doc should
describe what the function does - _especially_ considering any special
treatment, which is not obvious.






  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     ` Drew Adams [this message]
2009-07-22  3:15       ` Should nil COLLECTION element mean a "nil" candidateforcompleting-read? " 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
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

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

  git send-email \
    --in-reply-to=491580B15C204D059258DF3BD7740465@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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.