How to check that selectors exist

Nicola Pero nicola@brainstorm.co.uk
Tue Aug 6 05:02:00 GMT 2002


> > this code is not particularly well written, since in well written code you
> > should declare all methods in @interface before you refer to them,
> > supporting your @interface declaration with useful comments about what the
> > method is and does.  So I think it's actually good that the compiler warns
> > if you use a @selector() before the corresponding method is defined or
> > implemented, since it's helping in improve the quality of code.  It's ok
> > to have private methods, but not so much private that they are actually
> > obscure. :-)
> 
> I think you are trying to enforce a particular coding style here.
> And I am not at all convinced that this coding style is always appropriate.
> 
> Many modern programming languages permit forward references
> (e.g. calls to functions before they have been declared).
> In general the trend has been away from languages that require
> forwar declarations towards languages that allow arbitrary forward
> references.  And many programmers make use of this feature.
> 
> If the @interface occurs in a header file, there may be good reasons to
> leave the header file unchanged, even if you are adding a new private
> method.  It's very useful to be able to change the implementation without
> needing to modify the header file.

Just a minor comment - in Objective-C, you can have multiple @interface
for the same class (each @interface adding some new methods) - which means
you can declare the private methods inside the implementation file (not in
the header file), and add/remove/change those declarations at will,
without having to touch the header file.


> So I would lean towards accepting the patch.

Ok - thanks for your comments. :-)



More information about the Gcc-patches mailing list