lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Fri, Dec 14, 2012 at 2:42 PM, Javier Guerra Giraldez
<javier@guerrag.com> wrote:
> On Fri, Dec 14, 2012 at 3:18 PM, Jorge <xxopxe@gmail.com> wrote:
>> And when writing an API from scratch, which one annoys the user the less?
>
> as an API user, i much prefer the 'permisive', where any non-falsy
> value is true and both false and nil are false.
>
> --
> Javier
>

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().

/s/ Adam