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: Adam Fedor
Subject: Re: How to check that selectors exist
Date: Tue, 06 Aug 2002 08:28:42 -0600
User-agent: Mozilla/5.0 (X11; U; Linux ppc; en-US; rv:1.0rc2) Gecko/20020513

Nicola Pero wrote:
 4. it's completely inconsistent with how checks for functions and
variables and methods and everything are handled/done, since normally when
checking the compiler never 'looks ahead', while for selectors it would
do; this might look like an improvement at a first glance, but it actually
confused me a lot the first time I tried to use it, since the golden
standard rule that 'everything must be declared before being used' is no
longer valid, but a more complex, selector-specific, rule is used.


This is the main point for me, since I think selectors should be handled like functions in this respect, and it's just good practice (sometimes necessary!) to declare a function before you use it.

double foo(double a);

int bar()
{
  double b = foo(4.5);
}

thus:

@interface MyObject (PrivateMethods)
- (double) foo: (double)a
@end
@implementation MyObject
- (int) bar
{
  double b = [self foo: 4.5];
}
@end


--
Adam Fedor, Digital Optics Corp.      | I'm glad I hate spinach, because
http://www.doc.com                    | if I didn't, I'd eat it, and you
                                      | know how I hate the stuff.




reply via email to

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