[webkit-dev] Bools are strictly worse than enums

Nico Weber thakis at chromium.org
Fri Dec 3 13:55:26 PST 2010

On Fri, Dec 3, 2010 at 1:45 PM, Ryosuke Niwa <rniwa at webkit.org> wrote:
> 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:
> doSomethingElse(doSomething());
> doSomethingElse(shouldNotDoSomethingElse);
> etc...
> and we never call it with raw true/false:
> doSomethingElse(true)
> doSomethingElse(false)

Out of curiosity, what do people think of


when calling an existing function that takes a bool?


> - Ryosuke
> _______________________________________________
> webkit-dev mailing list
> webkit-dev at lists.webkit.org
> http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev

More information about the webkit-dev mailing list