[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Defining APIs, best practices.
- From: Coda Highland <chighland@...>
- Date: Sun, 16 Dec 2012 09:55:53 -0800
On Sun, Dec 16, 2012 at 9:30 AM, Jorge Visca <xxopxe@gmail.com> wrote:
> Documented as "true enables, false disables, nil keeps as is. Returns the
> status as set". I expect it to be used with a "true" or "false" passed
> directly, not as result of some previous computation.
> enable()/disable()/is_ernabled() would work just as good in this case, but
> like this i have only one method vs 3.
I've seen plenty of C++ APIs that do this (STL and Boost use this
scheme) and it drives me bonkers. But as long as it's consistent, it
is at least well-defined, and I won't hold it against the library.
I don't know how well automatic documentation would work, but this
DOES sound like a really good case for implementing properties using
__index/__newindex.
/s/ Adam
- 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
- Re: Defining APIs, best practices., Javier Guerra Giraldez
- Re: Defining APIs, best practices., Rena
- Re: Defining APIs, best practices., Andrew Starks
- Re: Defining APIs, best practices., Coda Highland
- Re: Defining APIs, best practices., Dirk Laurie
- Re: Defining APIs, best practices., Jorge Visca