[webkit-dev] Bools are strictly worse than enums

Maciej Stachowiak mjs at apple.com
Sat Dec 4 15:01:34 PST 2010


On Dec 3, 2010, at 2:08 PM, Alexey Proskuryakov wrote:

> 
> 03.12.2010, в 13:54, Eric Seidel написал(а):
> 
>> I'm not sure we have any examples of bool passing like that in real code.
> 
> 
> We do, although I can't provide one now. I just remember this being discussed in bug review.
> 
> I think that Dave's rule is best here, even if it meant that we couldn't check it automatically. But I think that we can try - just complain each time true or false is passed into a function. That may prove to be too chatty though.

That sounds about right to me. Passing a true or false literal (at least in cases where it's not the sole argument) is a likely indicator of unclear style, as opposed to taking a boolean argument. In fact, even putting a boolean literal in a named variable and then passing that is likely to be fairly clear.

Regards,
Maciej




More information about the webkit-dev mailing list