Bug 125988

Summary: Precede boolean values with words like "is" and "did".
Product: WebKit Reporter: Gergő Balogh <gbalogh.u-szeged>
Component: New BugsAssignee: Nobody <webkit-unassigned>
Status: RESOLVED INVALID    
Severity: Normal CC: commit-queue, darin, galpeter, glenn, ossy, rniwa
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
patch darin: review-, darin: commit-queue-

Description Gergő Balogh 2013-12-19 02:06:42 PST
Right:
bool isValid;
bool didSendData;

Wrong:
bool valid;
bool sentData;
Comment 1 Gergő Balogh 2013-12-19 05:25:20 PST
Created attachment 219641 [details]
patch
Comment 2 Darin Adler 2013-12-19 07:21:38 PST
Comment on attachment 219641 [details]
patch

This doesn’t seem like something the style checker can correctly check without linguistic analysis. For example, "requiresHeader" is a perfectly good name for a boolean. And "isRequiresHeader" is bad.
Comment 3 Gergő Balogh 2013-12-19 23:12:08 PST
(In reply to comment #2)
> (From update of attachment 219641 [details])
> This doesn’t seem like something the style checker can correctly check without linguistic analysis. For example, "requiresHeader" is a perfectly good name for a boolean. And "isRequiresHeader" is bad.

My opinion  is that every phrase in English (which has a truth-value) can be rephrase to begin with 'is' or 'did'. requiresHeader --> isHeaderRequired. Of course I am not a native speaker so it's may be wrong, but suppose it's true.
I always prefer the more formal notion over the others, but not over readability. So I think the key question here is not that is the 'is-free' form grammatical correct, rather do the 'is-form' help the reader or the code writer to understand the code.

An additional thought. If you use some kind of auto-completion tool and you know that every bool variable start with 'is', you can look for it, even you don't know the exact phrase that the developer used. We seen this before for example in the case of getters and setters in Java (getSomething(), setSomething()).

Of course these are only my opinion.
Comment 4 Ryosuke Niwa 2013-12-20 09:04:09 PST
I don't think we should do that.
Comment 5 Darin Adler 2013-12-20 09:58:00 PST
I don’t want to adopt this newly-suggested pseudo-grammatical style rule.
Comment 6 Ryosuke Niwa 2013-12-20 10:29:16 PST
Closing the bug as invalid.  If you feel strongly about this, please make a post on webkit-dev since we need a community-wide consensus to add a new style guideline like that.