This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: PATCH: Find more ObjC methods
- From: David Ayers <d dot ayers at inode dot at>
- To: Markus Hitter <mah at jump-ing dot de>
- Cc: Alexander Malmberg <alexander at malmberg dot org>, Ziemowit Laski <zlaski at apple dot com>, discuss-gnustep at gnu dot org, gcc-patches at gcc dot gnu dot org
- Date: Fri, 03 Oct 2003 11:57:44 +0200
- Subject: Re: PATCH: Find more ObjC methods
- References: <4BD8AE00-F586-11D7-8A4D-00039340BDFC@jump-ing.de>
Markus Hitter wrote:
Am Freitag, 03.10.03 um 04:10 Uhr schrieb Alexander Malmberg:
Ziemowit Laski wrote:
[snip]
in the long run, the compiler should stop distinguishing @interfaces
from
@implementations (since the former are merely forward declarations
for the latter).
I've always considered this a feature. The @interface is the public
interface for an @implementation. Thus, methods that appear only in
an implementation are private to that implementation.
It will stay there as a feature unless you get rid of header files at
all and #include the whole source when using a library.
That's surely not what Zem meant :-)
When the compiler parses the source, it keeps track of what it sees.
Currently it keeps track of methods encountered in @interface
declarations seperate from the current @implementation declaration.
Example:
@interface Foo
-(void)somePublicMethod;
@end
@implementation Foo
-(void)somePublicMethod {};
-(void)somePrivatMethod {};
-(void)someOtherPrivateMethod
{
[self somePrivateMethod];
}
@end
@implementation Foo (aCategory)
-(void)somePrivatCategoryMethod {};
-(void)someOtherCategoryMethod
{
[self somePrivatCategoryMethod];
[self somePrivatMethod]; /* <- should not see the prototype and warn! */
}
@end
If the compiler internals didn't distinguish between @implementation and
@interface that last line would not warn anymore. Yet I agree with Alex
that I see this as a feature.
Cheers,
David