Dan, my firm-but-not-rabid opinion on this has been formed from decades of
tracking down portability bugs, irreproducible bugs, etc.
Return 't'. Try to get the contract tightened up to specify t.
But so long as the contract is loose, in testing it can be useful to try to
inject defects by returni
Daniel Weinreb writes:
>
> If you have a function that is a predicate, in the sense that
> the function's contract says that its value should be interpreted
> as being either false or true, do you think it's better to code
> it so that it always returns "t" for the true case?
>
I use '-p' and
On Fri, Jan 14, 2011 at 8:42 AM, Daniel Weinreb wrote:
> If you have a function that is a predicate, in the sense that
> the function's contract says that its value should be interpreted
> as being either false or true, do you think it's better to code
> it so that it always returns "t" for the tr
No, it should just return "true" (non-nil). It shouldn't guarantee T as a
value, nor any particular "true" value.
It's wrong for the programmer using a predicate to rely on the "true" value
being any particular value, including T.
Therefore, doing the (when ... t) thing just makes it return on
On Jan 14, 2011, at 11:42 AM, Daniel Weinreb wrote:
> If you have a function that is a predicate, in the sense that
> the function's contract says that its value should be interpreted
> as being either false or true, do you think it's better to code
> it so that it always returns "t" for the true c
From: Edi Weitz
Date: Fri, 14 Jan 2011 17:59:52 +0100
Cc: Sergey Vasilyev ,
Common Lisp Professionals
There are lots of functions in the standard which are predicates in
that they return generalized booleans but on the other hand return
something "useful" if the resu
There are lots of functions in the standard which are predicates in
that they return generalized booleans but on the other hand return
something "useful" if the result is not NIL, e.g. MEMBER or STRING<.
I think this is good practice, i.e. return something other than T in
case this might make more
If you have a function that is a predicate, in the sense that
the function's contract says that its value should be interpreted
as being either false or true, do you think it's better to code
it so that it always returns "t" for the true case?
Since Common Lisp is quite clear that when a value
is