[webkit-dev] Fwd: Bools are strictly worse than enums

Ryosuke Niwa rniwa at webkit.org
Fri Dec 3 14:45:41 PST 2010


On Fri, Dec 3, 2010 at 2:30 PM, Darin Adler <darin at apple.com> wrote:
>
>  > 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."
>
> Beyond the enum guidelines, it’s also true that functions with these
> boolean/enum arguments often indicate minor design mistakes. Many times we
> would be better off with multiple functions rather than a single function
> with an enum argument.


I agree.  I prefer to have multiple public functions that are named
accordingly than having a single public function with enums.  However, we
could have a private function with enum that implements these public
functions to share code.

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


More information about the webkit-dev mailing list