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>, emacs-devel@gnu.org
Subject: RE: Naming predicates
Date: Fri, 28 Sep 2018 12:40:25 -0700 (PDT)	[thread overview]
Message-ID: <b0b59f31-fffe-4498-85c2-248b31beaf71@default> (raw)
In-Reply-To: <jwvd0sxwi02.fsf-monnier+gmane.emacs.devel@gnu.org>

> >>    If the purpose of a function is to tell you whether a certain
> >>    condition is true or false, give the function a name that ends in
> >>    'p' (which stands for "predicate").  If the name is one word, add
> >>    just 'p'; if the name is multiple words, add '-p'.  Examples are
> >>    'framep' and 'frame-live-p'.
> 
> *Users* should never define a single-word function, since they should
> use a namespace prefix.  Hence "I'd say you can simply always use "-p"
> when it's something you define".

Users are free to do _anything_ they like. As I said, "as a user you
can use whatever you want."

And users who write Lisp, creating a predicate, are not necessarily
writing a package or library, and they might well not want to use
a "namespace prefix."

And I believe (but I don't have a reference) that RMS pointed
out that the single-word recommendation does not include
a "namespace prefix". (Logically, it should not. IMO.)

Another consideration might be a multiple-word name that is
based on an existing name. It could be helpful to keep the
same name as a part, instead of adding a hyphen. 

> You don't have to follow them when you define your own function.

You never have to follow them, if you're not providing code
for the Emacs distribution. Does even code provided for
Emacs itself _have_ to follow them? If so, clearly that "have
to" has been bypassed or missed sometimes.

> > indivisible-p interactive-p ring-p registerv-p
> > bool-vector-subsetp coding-system-lessp default-boundp file-attributes-lessp
> > hack-one-local-variable-eval-safep ...
> 
> Yes, there are conflicting desires: when you define something that's
> very much like "foop" but in the context of "strigles", the multi-word
> rule suggest you name it "strigle-foo-p", but there's also an argument
> to be made for "strigles-foop".

Yes, that's just what I meant above.

> As the author of that function you get to follow whichever of the two
> you like.  Personally, I think always using "-p" is a simpler rule and
> is never wrong (that's the rule followed by `cl-defstruct`,
> incidentally).  Even using "-p" on single-word thingies is
> perfectly acceptable.

Acceptable does not mean conventional.



  reply	other threads:[~2018-09-28 19:40 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20180925021527.10418.61555@vcs0.savannah.gnu.org>
     [not found] ` <20180925021528.9A119204E8@vcs0.savannah.gnu.org>
2018-09-25 10:09   ` master d0c77a1: Remove some assumptions about timestamp format Michael Albinus
2018-09-26  1:09     ` Paul Eggert
2018-09-26  9:24       ` Michael Albinus
2018-09-26  9:39         ` Eli Zaretskii
2018-09-26  9:43           ` Michael Albinus
2018-09-27 20:46         ` Paul Eggert
2018-09-28  6:32           ` Eli Zaretskii
2018-09-28 10:26             ` Michael Albinus
2018-09-28 17:27               ` Paul Eggert
2018-09-29 13:35                 ` Michael Albinus
2018-09-28 14:45             ` Paul Eggert
2018-09-28 14:54               ` Michael Albinus
2018-09-28  1:50         ` Paul Eggert
2018-09-28 10:35           ` Michael Albinus
2018-09-28 17:39             ` Paul Eggert
2018-09-28 18:06               ` Naming predicates (was: master d0c77a1: Remove some assumptions about timestamp format) Stefan Monnier
2018-09-28 18:28                 ` Drew Adams
2018-09-28 19:12                   ` Paul Eggert
2018-09-28 19:26                     ` Naming predicates Stefan Monnier
2018-09-28 19:40                       ` Drew Adams [this message]
2018-09-28 19:41                     ` Naming predicates (was: master d0c77a1: Remove some assumptions about timestamp format) 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=b0b59f31-fffe-4498-85c2-248b31beaf71@default \
    --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).