Re: cocoa-dev digest, Vol 2 #2085 - 11 msgs
Re: cocoa-dev digest, Vol 2 #2085 - 11 msgs
- Subject: Re: cocoa-dev digest, Vol 2 #2085 - 11 msgs
- From: Christopher Sean Morrison <email@hidden>
- Date: Tue, 18 Mar 2003 16:53:49 -0500
THANK YOU!
Very useful and interesting reponses indeed.
>
You do not have to implement -forward::; in fact, fully implementing
>
-forward:: is difficult and isn't well documented. What you're seeing
>
is the runtime sending +initialize to the class when the first message
>
is sent. The runtime sees that you don't implement +initialize and then
>
tries to forward the +initialize message.
This is rather interesting. What provokes the +initialize call to be
made? The call to the Circle class method that returned self or some
initial future access to the returned object? Is there any literature on
intrinsics and details of the run-time (non-Cocoa-centric) available
anywhere?
>
If you don't need full -forward:: behavior from your classes, you can
>
simply implement an empty +initialize in your root class. If you do want
>
to implement an empty -forward::, note that it should be an instance
>
method of your root class. Object's forward is:
>
>
- forward: (SEL) sel : (marg_list) args
>
{
>
return [self doesNotRecognize: sel];
>
}
>
>
and -doesNotRecognize: prints an error message.
>
>
In order to work with the runtime itself, your root class needs:
>
* an isa pointer as the first field (type void* or Class is fine)
>
* an implementation of either +initialize or -forward::
>
>
Of course you'll want allocators and other such things for your classes,
>
but the runtime itself only demands the above. You should look at
>
runtime/Object.m in Darwin's objc4 project for sample implementations
>
of many basic methods. http://developer.apple.com/darwin/projects/darwin/
Bless you, Sir! I have more questions now, but I'll defer until I
checkout the objc4 code and look around some.. I assume the sourcecode
may also answer some details on why isa and +initialize are required by
the runtime. You've given me a lot to chew on. Thanks, again.
Cheers!
Sean Morrison
U.S. Army Research Laboratory
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.