[webkit-dev] Bools are strictly worse than enums

Ryosuke Niwa rniwa at webkit.org
Fri Dec 3 13:45:20 PST 2010

On Fri, Dec 3, 2010 at 1:37 PM, David Hyatt <hyatt at apple.com> wrote:
> The only exception I would make to this rule is if all the call sites use
> variables and never pass in raw true or false.  In that case there's no loss
> of readability, and whether you use an enum vs. a bool is irrelevant.
> I think in general the rule should be "Keep your call sites readable, and
> convert to enums if you find that the call sites are becoming inscrutable."

That rule makes sense to me.

On Fri, Dec 3, 2010 at 1:40 PM, Eric Seidel <eric at webkit.org> wrote:

> Dave, I'm not sure I understand your exception.  Could you give an example?

I think what he means is that
bool doSomething();
void doSomethingElse(bool);

and the only case we always call doSomethingElse with a return value of some
function or with a variable:

and we never call it with raw true/false:

- Ryosuke
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-dev/attachments/20101203/cf915c1e/attachment.html>

More information about the webkit-dev mailing list