[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Defining APIs, best practices.
- From: Javier Guerra Giraldez <javier@...>
- Date: Fri, 14 Dec 2012 18:44:59 -0500
On Fri, Dec 14, 2012 at 6:33 PM, Coda Highland <chighland@gmail.com> wrote:
> If and only if the function detects the difference between (nil) and
> (). If the function is called enable, and I call it as enable(), I
> would expect it to enable the object -- that is, the same as
> enable(true), not enable(false)! So it's messy.
>
> For this reason I prefer setEnabled(bool) over enable(bool), which
> also means the matching predicate is isEnabled().
about semantics and names:
i'd expect a "enable()" function to always enable. and a
"setEnabled()" to take a flag.
no mess with "enable()==enable(nil)==enable(false)==disable()"
--
Javier
- References:
- Defining APIs, best practices., Jorge
- RE: Defining APIs, best practices., Thijs Schreijer
- Re: Defining APIs, best practices., Jorge
- Re: Defining APIs, best practices., Javier Guerra Giraldez
- Re: Defining APIs, best practices., Coda Highland