Objective-C Issues

preprocessor

People ( From: lines )
 athan@object.com (Andrew C . Athan)
Subjects ( 1 mails )
 Preprocessor & class/instance methods
Document
Date: Mon, 21 Sep 92 02:29:37 -0400
From: athan@object.com (Andrew C . Athan)
To: gnu-objc@prep.ai.mit.edu
Subject: Preprocessor & class/instance methods



By the way:

(1) Has anyone considered expanding the preprocessor functionality?  One useful 
    set of features might allow method calls to be rewritten.  

E.g., in ANSI C I can do:

#define foobar(a,b,c) barbar(c,a,b)

but how can I rewrite:

[foo setThis:a toThat:b from:c]  -->  [foo setThat:b toThis:a from:c]



(2) I think we need to think about the nature of class vs. instance 
method declarations.  There are some inconsistencies/deficiencies in 
the language  regarding 
their declarations.  One definite miss is the inability to declare a 
pointer to a _class_ object.

Another possible feature would be the ability to declare 
class&instance methods.  I.e., a method that both the class and the 
instance responds to (of course, the method code cannot therefore 
refer to any instance variables).  E.g.:

-+ countDigitsOf:(const char *)s { ... };

instead of

+ countDigitsOf:(const char *)s { ... };
- countDigitsOf:(const char *)s { [[self class] countDigitsOf:s]; }

The semantics would be that countDigitsOf: is added to the method 
dispatch table of both the class and instance objects.  I.e., the 
call is exactly equivalent.  This would work because in theory the 
instance object is a subclass of it's class object's class (Object).

Andrew Athan

Statistics
 filename:           preprocessor
 number of mails:    1
 number of writers:  1
 line count:         47
 word count:         221
 character count:    1470

created by Helge Hess ( helge@mdlink.de )
MDlink online service center ( www.mdlink.de )