unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Drew Adams <drew.adams@oracle.com>
To: Michael Heerdegen <michael_heerdegen@web.de>
Cc: 26564@debbugs.gnu.org, Kaushal Modi <kaushal.modi@gmail.com>
Subject: bug#26564: Document that only functions and not variables can end with "-p"
Date: Wed, 19 Apr 2017 15:01:04 -0700 (PDT)	[thread overview]
Message-ID: <716db14c-b67b-4477-b4c2-75478df0c313@default> (raw)
In-Reply-To: <87h91kdqdv.fsf@drachen>

> > 3. Is there a proposal for a _different_ naming convention
> > for Boolean variables?  I'd argue that we should have some
> > such a naming convention.  And I'd argue that it should be
> > different for options and non-option variables.
> 
> That's a good point indeed.
> 
> An alternative to "-p" would be "is-", like `foo-is-negative'.

Not great for cases where "has-" would be more appropriate (and
vice versa, for cases where "is-" would be more appropriate).
Not good for lots of other cases too.

E.g., `box-cursor-when-idle-p' or `use-foo-bar-p' or
`remove-foo-props-p' or `iac1-was-cycling-p' or
`foo-names-only-p' or `hl-line-when-idle-p'?

I suggest we stay away from helper verbs (or even any words).
Verbs, in particular, can be different for singular and plural
(e.g. `fancy-candidates-p').

> Not using -p would also have an advantage: you could distinguish
> boolean variables from variables bound to a predicate function.

How is it difficult to distinguish those if `-p' is used for
both?

It's true that in some (very few) contexts just looking at
"'foo-p" in some code might not let you know whether `foo-p'
is a variable or a function (or is both), but it is trivial
to find out which is the case, for any symbol that is already
defined as a variable or a function.





  reply	other threads:[~2017-04-19 22:01 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-19 15:47 bug#26564: Document that only functions and not variables can end with "-p" Kaushal Modi
2017-04-19 16:08 ` Eli Zaretskii
2017-04-19 16:22   ` Kaushal Modi
2017-04-19 21:49     ` Michael Heerdegen
2017-04-19 22:04       ` Drew Adams
2017-04-19 22:18         ` Michael Heerdegen
2019-10-12 20:27     ` Lars Ingebrigtsen
2019-10-12 20:47       ` Kaushal Modi
2019-10-12 23:18       ` Drew Adams
2019-10-14  1:50         ` Richard Stallman
2019-10-14  2:22           ` Drew Adams
2019-10-14  7:24             ` Eli Zaretskii
2019-10-14  7:21           ` Eli Zaretskii
2017-04-19 17:26 ` Drew Adams
2017-04-19 21:44   ` Michael Heerdegen
2017-04-19 22:01     ` Drew Adams [this message]
2017-04-19 22:23       ` Michael Heerdegen
2017-04-19 22:28         ` Drew Adams
2017-04-20  1:42           ` 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=716db14c-b67b-4477-b4c2-75478df0c313@default \
    --to=drew.adams@oracle.com \
    --cc=26564@debbugs.gnu.org \
    --cc=kaushal.modi@gmail.com \
    --cc=michael_heerdegen@web.de \
    /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).