private slots
Luciano Montanaro
mikelima at gmail.com
Sat Jan 6 11:30:48 GMT 2007
On Saturday 06 January 2007 11:32, André Wöbbeking wrote:
> On Saturday 06 January 2007 11:19, Scott Wheeler wrote:
> > André Wöbbeking wrote:
> > > Maybe a bad habit but very often I use the source code instead of
> > > the docs so I would "find" the _k_* slot very fast.
> >
> > That's pretty irrelevant. Ideally you're not trying to write broken
> > applications and are smart enough to figure out that you're not
> > supposed to call those functions. ;-)
>
> Well, it's about writing working software. Sometimes the public API
> isn't sufficient and the programmer is looking for workarounds (as
> mentioned before, even #define private public). Of course programmers
> shouldn't use such hacks.
I can't see a reason to put checks at runtime to prevent people from using
private functions.
They are documented as private. That means the slot is not meant to be used
outside its circle of friends (outside the library or module).
If one wanted to be nasty, he could write a macro to change the name of the
private slot at every minor release...
But that would gain nothing, really.
The point of guaranteeng API and ABI compatibility is to make programming
easier. So, ensuring people shoots themselve in the foot when they pull the
trigger is not the library developer buisness.
>
> Most the time an API author has good reasons to make parts of the API
> private and he is probably not happy if access control can be bypassed
> so easily.
Well, private stuff is not part of the API at all, it is part of the
implementation.
Luciano
--
Luciano Montanaro //
\X/ mikelima at cirulla.net
More information about the kde-core-devel
mailing list