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: Andrew Farmer <email@hidden>
- Date: Sat, 20 Dec 2008 01:05:43 -0800
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 type-checking validation
method. Or request a compile-time directive to determine the static
type of a method return or a property. (Hmm. gcc has a "typeof"
extension. I wonder if it works in Objective-C.)
I'm pretty sure that typeof is, like sizeof, purely a compile-time
directive. All it'll do when applied to an object pointer is return
the declared type of the pointer.
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.
_______________________________________________
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