[Top][All Lists]

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

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

From: Alex Vong
Subject: Re: ?-suffix for booleans... good-idea? or bad-idea?
Date: Tue, 25 Apr 2017 11:43:23 +0800
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux)

Good question! I can't decide as well. I want to know how people think
about it.

In a lazy language, a variable is a 0-ary thunk, while a predicate is a
1-ary thunk. Since they are really just special case of a general thing,
it make sense to use foo? for both cases. But we all know guile is not
lazy, so I really don't know what to do.

Christopher Allan Webber <address@hidden> writes:

> 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

Attachment: signature.asc
Description: PGP signature

reply via email to

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