Re: Using runtime functions to match up object types safely when setting properties
Re: Using runtime functions to match up object types safely when setting properties
- Subject: Re: Using runtime functions to match up object types safely when setting properties
- From: "Michael Ash" <email@hidden>
- Date: Sat, 20 Dec 2008 12:07:05 -0500
On Sat, Dec 20, 2008 at 5:16 AM, Graham Cox <email@hidden> wrote:
> KVV works pretty well for this - it also solves another related situation
> where I can usefully convert objects to other types in some cases - but what
> I still haven't quite worked out yet is how to *prevent* the situation
> arising in the first place, in other words, given a list of methods, and an
> object class, how to filter out those methods/properties from a list that
> can't accept the object.
There is no way to prevent the situation in the first place using
standard techniques. All that static typing information gets thrown
away when you compile. At runtime all that survives is the knowledge
that your method takes an object pointer of some kind.
You could build a table, either manually or perhaps with the help of
some sort of crazy macro. But there is absolutely no way to get the
NSColor out of -(void)setColor:(NSColor*)c at runtime because that
info simply isn't there.
Mike
_______________________________________________
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