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: Ziemowit Laski
Subject: Re: PATCH: Find more ObjC methods
Date: Fri, 3 Oct 2003 11:44:57 -0700


On Friday, Oct 3, 2003, at 02:57 US/Pacific, David Ayers wrote:

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.

Yes, exactly. :-)


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

No, here is where I disagree. Clearly, the compiler has seen the @implementation containing the method in question, so it knows it is there. Not sure why you'd want the compiler to look the other way? :-)

--Zem
--------------------------------------------------------------
Ziemowit Laski                 1 Infinite Loop, MS 301-2K
Mac OS X Compiler Group        Cupertino, CA USA  95014-2083
Apple Computer, Inc.           +1.408.974.6229  Fax .5477





reply via email to

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