discuss-gnustep
[Top][All Lists]
Advanced

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

Re: PATCH: Find more ObjC methods


From: David Ayers
Subject: Re: PATCH: Find more ObjC methods
Date: Fri, 03 Oct 2003 11:57:44 +0200
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.5) Gecko/20030916

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






reply via email to

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