lua-users home
lua-l archive

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

On Jan 19, 2005, at 11:04, Steve Donovan wrote:

So no matter how one sets up one's object system,
such a convention would allow general tools
to be built that don't require detailed knowledge
of the object system.

Well... yes and no... as you have mentioned, you need to agree on some form of standardized metadata one way or another...

For what it's worth, here is what the Objective-C runtime does:

objc_getClassList() // getting all the classes in the runtime...

A class is defined as a simple C structure:

struct objc_class
	struct objc_class *isa;	
	struct objc_class *super_class;	
	const char *name;		
	struct objc_ivar_list *ivars;
	struct objc_method_list **methodLists;
 	struct objc_protocol_list *protocols;

You then have some functions to access those class informations:

class_nextMethodList()		// get all the methods of an object

class_getInstanceMethod()	//  get information about an instance method
class_getClassMethod		// get information about a class method

Out of those, you can finally build a method signature: ObjC_classic/Classes/NSMethodSignature.html

That's pretty much it.

See the attachments for the actual C headers. Food for thoughts :)



Attachment: objc-runtime.h
Description: Binary data

Attachment: objc-class.h
Description: Binary data