[pro] Style issue about predicates

Scott L. Burson Scott at sympoiesis.com
Fri Jan 14 17:23:34 UTC 2011


On Fri, Jan 14, 2011 at 8:42 AM, Daniel Weinreb <dlw at itasoftware.com> 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 case?

I've never bothered.

Of course I'm also one of these people who routinely use AND and OR to
return non-boolean values, which apparently a lot of people dislike
(it's specifically contravened in Peter Norvig's style guide, for
instance).

BTW I prefer the trailing question mark convention over "-p".  Scheme
uses the question mark, but I'm not sure the convention originated
there -- I think it may actually have started in the InterLisp
community.  Does anyone know?

-- Scott




More information about the pro mailing list