From: Jan Wedekind <jan@wedesoft.de>
To: Alex Vong <alexvong1995@gmail.com>,
Christopher Allan Webber <cwebber@dustycloud.org>
Cc: "guile-user@gnu.org" <guile-user@gnu.org>
Subject: Re: ?-suffix for booleans... good-idea? or bad-idea?
Date: Tue, 25 Apr 2017 16:50:08 +0100 [thread overview]
Message-ID: <ccb1d875-3db2-4c79-9c28-ca50a84e6546@email.android.com> (raw)
In-Reply-To: <87inltgnj8.fsf@gmail.com>
In Ruby ...? is used for methods returning boolean. E.g. 5.even?. Boolean variables are not sufficed. E.g. x = 5.even? The method call "even?" is the question. "x" is the answer.
On 25. April 2017 04:43:23 GMT+00:00, Alex Vong <alexvong1995@gmail.com> wrote:
>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 <cwebber@dustycloud.org> 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
--
Diese Nachricht wurde von meinem Android-Mobiltelefon mit K-9 Mail gesendet.
next prev parent reply other threads:[~2017-04-25 15:50 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-24 17:01 ?-suffix for booleans... good-idea? or bad-idea? Christopher Allan Webber
2017-04-25 3:43 ` Alex Vong
2017-04-25 15:50 ` Jan Wedekind [this message]
2017-04-25 16:21 ` Paul
2017-04-26 15:25 ` Alex Kost
2017-04-25 18:08 ` Neil Jerram
2017-04-25 16:53 ` Panicz Maciej Godek
2017-04-26 0:23 ` Thompson, David
2017-04-27 10:39 ` Jan Nieuwenhuizen
2017-04-27 10:53 ` Panicz Maciej Godek
2017-04-27 12:07 ` Marko Rauhamaa
2017-05-05 17:26 ` Vladimir Zhbanov
2017-05-05 19:44 ` szgyg
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/guile/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ccb1d875-3db2-4c79-9c28-ca50a84e6546@email.android.com \
--to=jan@wedesoft.de \
--cc=alexvong1995@gmail.com \
--cc=cwebber@dustycloud.org \
--cc=guile-user@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).