gnustep-dev
[Top][All Lists]
Advanced

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

Re: How to check that selectors exist


From: Nicola Pero
Subject: Re: How to check that selectors exist
Date: Tue, 6 Aug 2002 13:02:06 +0100 (BST)

> > 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. :-)




reply via email to

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