|
From: | Bob Gilson |
Subject: | Re: Grasping Gorm |
Date: | Tue, 02 Apr 2002 13:31:58 -0700 |
User-agent: | Mozilla/5.0 (X11; U; Linux i686; en-US; rv:0.9.8) Gecko/20020205 |
Stefan Rieken wrote:
6. GNUstep now uses REALLY black magic to connect the outlets to the UI components. How does it do this? There are no methods in the user-built class that send the contents of any of the "outlet" instance variables to any other object. As far as I've learnt OO and Objective-C, there's NO way for the UI objects to get these instance variables if there's no method for it (e.g. [rectangle length]). How how how?
Its not black magic its the Objective-C runtime. Take a read through Object.h and objc-api.h. In obj-api.h you'll find raw access to the runtime. You should be able to see that from this you can build the functionality found in Object.h. And from there you can build the functionality found in Gorm. It becomes a matter of building a more friendly or powerful bunch of functionality for the task at hand.
On my system they're in /usr/local/lib/gcc-lib/i686-pc-linux-gnu/3.0.4/include/objc. You'll find types, structures, functions and methods which can:
Describe a class's methods and instance variables which is useful for building the GUI for connecting outlets and actions.
- (struct objc_method_description *)descriptionForMethod:(SEL)aSel;Execute methods and their underlying functions which is useful for making the target/action work and unarchiving the .gorm files.
- perform:(SEL)aSel with:anObject; + (IMP)instanceMethodFor:(SEL)aSel; IMP method_get_imp(Method_t method)Give access to instance variables which is useful when a class doesn't provide a -setMyVariable: method.
typdef for IvarListAfter you get a feel for what the Obj-C runtime provides compare it with what C++(almost nothing) or Java(Reflection) provides.
Hope this helps, Bob
[Prev in Thread] | Current Thread | [Next in Thread] |