guile-user
[Top][All Lists]
Advanced

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

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


From: Jan Wedekind
Subject: Re: ?-suffix for booleans... good-idea? or bad-idea?
Date: Tue, 25 Apr 2017 16:50:08 +0100
User-agent: K-9 Mail for Android

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 <address@hidden> 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 <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

-- 
Diese Nachricht wurde von meinem Android-Mobiltelefon mit K-9 Mail gesendet.


reply via email to

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