Re: creating classes on the fly ??
Re: creating classes on the fly ??
- Subject: Re: creating classes on the fly ??
- From: Karsten <email@hidden>
- Date: Fri, 5 Oct 2007 01:14:40 +0200
Well i was wondering why one would want to create classes on the
fly...i mean, there may be reasons for this, but i don't think that
storing data could be the reason to do this. Besides Cocoa i'm
developing with Smalltalk a lot and there're it is no problem to
create classes and to compile methods dynamically, but there're really
not many reasons why you would want to do this. I created classes and
methods on the fly in order to store information using a source code
management system, but besides this reason i don't see much advantage
against storing data in some model classes that are good enough to
handle all the data you would want to store. I think code data may do
a big deal in helping you out there.
Another thing is that i don't know how you are going to debug the
stuff that you are creating on the fly?! i mean... if you have the
classes, and the methods (however you compile them at runtime in
cocoa), how do you want to debug the execution of these methods?
just my 2++ct
Karsten
Am 04.10.2007 um 16:13 schrieb Daniel Child:
From your link, I can see that in theory, at least, that class
creation could be done, though it looks very involved. I didn't see
how you would do methods, though. I think for now I will stick to a
prototype with built-in classes, and will consider this issue again
when I am less of a novice.
Thanks for the link.
On Sep 21, 2007, at 5:32 PM, Scott Thompson wrote:
On Sep 21, 2007, at 4:23 PM, Daniel Child wrote:
*** Is it possible to define the details of a class dynamically?
For example, let's say I use the generic parser to parse lexicon
flat files having different data structures. Is there any way in
Cocoa to create the class and describe the type and number of
instance variables dynamically?
Yes. That's how tools like RubyCocoa and PyObjC can interact with
Objective-C code.
see
http://developer.apple.com/documentation/Cocoa/Reference/ObjCRuntimeRef/Reference/reference.html
There are two things to note, however. First the mechanism could
change between releases of the OS. In particular, there is
evidence to suggest that it will change somewhat in Leopard (though
I suspect it will become easier to do in Leopard than it is in
Tiger).
Scott
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden