[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: coding standard for allowed arguments of predicates
From: |
Roland Winkler |
Subject: |
Re: coding standard for allowed arguments of predicates |
Date: |
Fri, 18 Dec 2020 15:59:46 -0600 |
On Fri Dec 18 2020 Philipp Stephani wrote:
> Am Fr., 18. Dez. 2020 um 15:49 Uhr schrieb Roland Winkler <winkler@gnu.org>:
> > The context of my question is `iso8601-valid-p'. It assumes that
> > its argument must be a string. Is this a bug? In my usage example,
> > the argument of `iso8601-valid-p' could also be nil.
>
> There are lots of predicates that accept only certain types, e.g.
> (file-readable-p 123) also signals an error. Typically only the
> predicates that check for types (stringp, integerp, listp, etc.)
> accept any type.
Thanks; thinking about this once more it makes sense that not all
predicates need to check the type of their arguments. In the
example of `iso8601-valid-p' one could argue that it is at the
borderline of the class of predicates that check for (in this case:
very particular) types. But a caller of this predicate can handle
the possibility of non-string arguments, too.