objective c - Why isn't it possible to declare multiple method prototypes per line? -
given that…
@interface hog : nsobject { nsuinteger one, two, three; } @property (strong, nonatomic) nsstring *four, *five, *six; -(void) seven; @end @implementation hog static cgfloat f, ff, fff; - (nsstring*) 6 { return _four = _five = _six = @"sexy"; } - (void) 7 { 1 = 2 = 3 = 33; f = ff = fff = 6.66; sel sevenselect = @selector(seven); nslog(@" %ld, %0.2f, %@, %@", three, fff, self.six, nsstringfromselector(sevenselect)); } @end int main(int argc,char *argv[]){ hog *u = hog.new; [u seven];} output: 33, 6.66, sexy, 7
then.. why isn't possible then, declare
-(void)seven, eight, nine;
in header, etc? what's difference? doesn't objc-c
treat imp
, or whatever is, same way other variable, block, etc? why bother prototype, anyways? especially, why bother if in class extension, , you're going write method directly underneath. seems opportunity mistakes, , needless repetition, no? know i'm wrong, i'm asking schooled, go ahead.
method declarations not same thing, syntactically, variable declarations. have different syntax , can occur in specific contexts.
would possible modify objective-c's syntax allow multiple variable declarations separated commas? yes, — require bigger changes you're envisioning, declarations can lot more complex when include arguments. , there's little point in making major syntactic change allow people write less readable declarations. there literally 0 benefit that.
Comments
Post a Comment