RESOLVED INVALID 125988
Precede boolean values with words like "is" and "did".
https://bugs.webkit.org/show_bug.cgi?id=125988
Summary Precede boolean values with words like "is" and "did".
Gergő Balogh
Reported 2013-12-19 02:06:42 PST
Right: bool isValid; bool didSendData; Wrong: bool valid; bool sentData;
Attachments
patch (4.39 KB, patch)
2013-12-19 05:25 PST, Gergő Balogh
darin: review-
darin: commit-queue-
Gergő Balogh
Comment 1 2013-12-19 05:25:20 PST
Darin Adler
Comment 2 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.
Gergő Balogh
Comment 3 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.
Ryosuke Niwa
Comment 4 2013-12-20 09:04:09 PST
I don't think we should do that.
Darin Adler
Comment 5 2013-12-20 09:58:00 PST
I don’t want to adopt this newly-suggested pseudo-grammatical style rule.
Ryosuke Niwa
Comment 6 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.
Note You need to log in before you can comment on or make changes to this bug.