[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

?-suffix for booleans... good-idea? or bad-idea?

From: Christopher Allan Webber
Subject: ?-suffix for booleans... good-idea? or bad-idea?
Date: Mon, 24 Apr 2017 12:01:06 -0500
User-agent: mu4e 0.9.18; emacs 25.2.1

Hello everyone!  Here's a little bikeshed for us to paint.

I've noticed that it's common in Guile modules to use "foo?" for
variable names involving booleans.  It's tempting, because this looks
an awful lot like you're asking a question... and it's also common
for this even to be keyword arguments to procedures, etc.

But is it a good idea?  I thought "foo?" was supposed to be for
predicates, as a nicer version of the "foo-p" predicate convention in
other non-scheme lisps.  I can't imagine other lisps doing "foo-p" for
just variables with boolean values.

On the other hand, once you start adding ? to the end of boolean'y
things, it *does* become tempting to put them at the end of boolean
variables and arguments.  It looks pretty nice.

What do people think?  I'm struggling with deciding what's the right
thing for my own code, but leaning towards "we shouldn't use the ?
suffix for just boolean values".

 - Chris

reply via email to

[Prev in Thread] Current Thread [Next in Thread]