Collection Object
Shaun Wexler
dev at macfoh.com
Thu Aug 3 02:46:40 CDT 2006
On Aug 3, 2006, at 1:08 AM, Ruslan Zasukhin wrote:
> Does objC do at runtime string compare of name method for an
> instance to
> find if this object have this or that method ?
Yes and no. An object exists in memory like this (pseudo):
typedef const char *SEL; // method name
typedef struct objc_class *Class;
typedef Class *id;
struct Object {
Class isa;
} Object;
class MyDirectObjectSubclass : Object {
id something;
char string[4];
void *etc;
}
Dispatching a message is simply a function call with predefined arg's:
retval = (*methodIMP)(id self, SEL _cmd, args...);
The "magic" is how the methodIMP* is first resolved: quick lookup in
objc_class method cache buckets, else by linear method-table search,
keyed by the SEL (which only compares its void* value, rather than by
strcmp).
The approach I would like to take for the forthcoming Valentina 3
versions is to toll-free bridge the C++ FBL classes with CF/NS. I
know can do it! I have the power... ;)
--
Shaun Wexler
MacFOH
http://www.macfoh.com
More information about the Valentina
mailing list