Re: Using runtime functions to match up object types safely when setting properties

2008-12-20 Thread Andrew Farmer
On 19 Dec 08, at 19:28, Ken Thomases wrote: I think your only avenue is to implement explicit KVV methods for your properties which have the necessary knowledge to test their type. I suppose you could file a feature request to extend declared properties so they can synthesize a

Re: Using runtime functions to match up object types safely when setting properties

2008-12-20 Thread Graham Cox
On 20 Dec 2008, at 8:05 pm, Andrew Farmer wrote: However, I think you've overengineering things here. The standard runtime introspection methods, like [NSObject class] and [NSObject isKindOfClass:], should be more than enough to implement this sort of functionality. You might be right

Re: Using runtime functions to match up object types safely when setting properties

2008-12-20 Thread Michael Ash
On Sat, Dec 20, 2008 at 5:16 AM, Graham Cox graham@bigpond.com 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

Re: Using runtime functions to match up object types safely when setting properties

2008-12-20 Thread Graham Cox
On 21 Dec 2008, at 4:07 am, Michael Ash wrote: 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. Yep, I've come

Re: Using runtime functions to match up object types safely when setting properties

2008-12-20 Thread Andrew Farmer
On 20 Dec 08, at 02:16, Graham Cox wrote: On 20 Dec 2008, at 8:05 pm, Andrew Farmer wrote: However, I think you've overengineering things here. The standard runtime introspection methods, like [NSObject class] and [NSObject isKindOfClass:], should be more than enough to implement this sort

Using runtime functions to match up object types safely when setting properties

2008-12-19 Thread Graham Cox
In my app, I have an interface and code that allows the user to set up different values that can be set as properties of an object. The user is presented with a list of properties that can be set (suitably converted for display in the UI) and then they can set up the values of these

Re: Using runtime functions to match up object types safely when setting properties

2008-12-19 Thread Ken Thomases
On Dec 19, 2008, at 6:53 PM, Graham Cox wrote: In my app, I have an interface and code that allows the user to set up different values that can be set as properties of an object. The user is presented with a list of properties that can be set (suitably converted for display in the UI) and

Re: Using runtime functions to match up object types safely when setting properties

2008-12-19 Thread Graham Cox
On 20 Dec 2008, at 2:28 pm, Ken Thomases wrote: First of all, are you familiar with Key-Value Validation? http://developer.apple.com/DOCUMENTATION/Cocoa/Conceptual/KeyValueCoding/Concepts/Validation.html So I'm looking for a way to safely and reliably determine whether a property will