[Top][All Lists]

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

PATCH: Find more ObjC methods

From: Vaisburd, Haim
Subject: PATCH: Find more ObjC methods
Date: Fri, 3 Oct 2003 13:21:09 -0700

Ziemovit Laski wrote:

>>>  [self somePrivatMethod]; /* <- should not see the prototype and 
>>> warn! */
>> Does this mean that using private methods, that are not included
>> in @interface, is not a good idea? I think, compiler should figure
>> out that it is part @implementation and not warn about it.

> you do not _need_ to provide an @interface at
> all!  It may not be very polite, but if the @implementation contains 
> the required ivars, the compiler knows what to do.

So is this how Objective C is designed or just an artefact
of current compiler implementation?

> Furthermore, methods in Objective-C are not 'private' (or 'protected') 
> in the C++ sense; all methods _are_ visible to the runtime.

As far as I understand, the same thing happens in C++ : all "private"
information is accessible at runtime, it is the compiler that creates
obstacles (which can be good or bad). In C++ you can substitute the
header with your own (e.g. #define private public) and access the private

I like "fast and loose" myself, however I can see two cases where the
warning suggested by David can be useful:
1. I forgot to include the prototype in the header.
2. I intended the method to be private, i.e. I want to discourage
   it's use by someone else.

On the other hand, I might be influenced by my C++ experience.

Does the language (as opposed to its implementation) says
anithing on that matter?

Thank you,

reply via email to

[Prev in Thread] Current Thread [Next in Thread]