From: Tom Lane <tgl@sss.pgh.pa.us>
To: David Rowley <dgrowleyml@gmail.com>
Cc: Peter Eisentraut <peter@eisentraut.org>
Cc: PostgreSQL Developers <pgsql-hackers@lists.postgresql.org>
Subject: Re: Fixing MSVC's inability to detect elog(ERROR) does not return
Date: Wed, 17 Sep 2025 00:02:56 -0400
Message-ID: <1438905.1758081776@sss.pgh.pa.us> (raw)
In-Reply-To: <CAApHDvojMx2YEemTp8qVD6VCQkJN6PSW_naFrSVZTyeSGtYbNg@mail.gmail.com>
References: <CAApHDvom02B_XNVSkvxznVUyZbjGAR+5myA89ZcbEd3=PA9UcA@mail.gmail.com>
<d38be90a-3e7a-42e0-a844-a7a122392c7e@eisentraut.org>
<CAApHDvpZyaTcyjrQ0cYxusJe6M=6QrmfZHue=Q1=7+ZpWymHHA@mail.gmail.com>
<a92097fa-a7e3-406b-a160-4988e690c6ca@eisentraut.org>
<CAApHDvojMx2YEemTp8qVD6VCQkJN6PSW_naFrSVZTyeSGtYbNg@mail.gmail.com>
David Rowley <dgrowleyml@gmail.com> writes:
> On Wed, 3 Sept 2025 at 23:32, Peter Eisentraut <peter@eisentraut.org> wrote:
>> Btw., I think we should stick to the *_p() naming (for "predicate", I
>> think) for compiler-intrinsic-affiliated functions/macros that report
>> boolean results.
> I didn't know what the _p suffix was meant to indicate. Do you have a
> link which states that it's for "predicate"?
It absolutely stands for "predicate". That's an ancient Lisp-ism.
Here's the first link I found with some quick googling:
https://www.cs.cmu.edu/Groups/AI/html/cltl/clm/node69.html
A predicate is a function that tests for some condition involving
its arguments and returns nil if the condition is false, or some
non-nil value if the condition is true. One may think of a
predicate as producing a Boolean value, where nil stands for false
and anything else stands for true. Conditional control structures
such as cond, if, when, and unless test such Boolean values. We
say that a predicate is true when it returns a non-nil value, and
is false when it returns nil; that is, it is true or false
according to whether the condition being tested is true or false.
By convention, the names of predicates usually end in the letter p
(which stands for ``predicate''). Common Lisp uses a uniform
convention in hyphenating names of predicates. If the name of the
predicate is formed by adding a p to an existing name, such as the
name of a data type, a hyphen is placed before the final p if and
only if there is a hyphen in the existing name. For example,
number begets numberp but standard-char begets standard-char-p. On
the other hand, if the name of a predicate is formed by adding a
prefixing qualifier to the front of an existing predicate name,
the two names are joined with a hyphen and the presence or absence
of a hyphen before the final p is not changed. For example, the
predicate string-lessp has no hyphen before the p because it is
the string version of lessp (a MacLisp function that has been
renamed < in Common Lisp). The name string-less-p would
incorrectly imply that it is a predicate that tests for a kind of
object called a string-less, and the name stringlessp would
connote a predicate that tests whether something has no strings
(is ``stringless'')!
Okay, that last part is pretty far down in the weeds. But a "p"
suffix meaning "predicate" has decades of history behind it.
regards, tom lane
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-hackers@postgresql.org
Cc: tgl@sss.pgh.pa.us, dgrowleyml@gmail.com, peter@eisentraut.org
Subject: Re: Fixing MSVC's inability to detect elog(ERROR) does not return
In-Reply-To: <1438905.1758081776@sss.pgh.pa.us>
References: <CAApHDvom02B_XNVSkvxznVUyZbjGAR+5myA89ZcbEd3=PA9UcA@mail.gmail.com> <d38be90a-3e7a-42e0-a844-a7a122392c7e@eisentraut.org> <CAApHDvpZyaTcyjrQ0cYxusJe6M=6QrmfZHue=Q1=7+ZpWymHHA@mail.gmail.com> <a92097fa-a7e3-406b-a160-4988e690c6ca@eisentraut.org> <CAApHDvojMx2YEemTp8qVD6VCQkJN6PSW_naFrSVZTyeSGtYbNg@mail.gmail.com> <1438905.1758081776@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox