Re: string convertion: converting getter name to setter
Re: string convertion: converting getter name to setter
- Subject: Re: string convertion: converting getter name to setter
- From: Phil <email@hidden>
- Date: Fri, 5 Sep 2008 16:25:20 +1200
On Fri, Sep 5, 2008 at 2:51 PM, steph thirion <email@hidden> wrote:
> I was trying to go with performSelector, but just a while ago I was stunned
> to find out there's no way to pass along an argument that is a basic type.
> Same with NSInvocation, AFAIK you can only pass objects. And I'd rather
> avoid having NSNumber instances instead of simply int variables just because
> of that. Using an instance where I simply need an int or a float seems a
> waste of memory and performance, correct me if I'm wrong.
>
You can use +instanceMethodForSelector: to get a function that you can
use to call the method with primitive arguments---see the overview
section of the NSObject class reference.
> Then there's KVC. Which I haven't been able to pull out because of some int
> / id problems in arithmetics that I couldn't understand yet. But the concept
> of KVC seems like it could be costly, at least more than pointing directly
> to the right door, like performSelector or NSInvocation does.
However, finding the correct door is probably just as costly (or
potentially more than) KVC. I'd suggest avoiding developing your own
solution unless you know there's a problem with using what's provided
by the framework.
If you can tell us a bit more about what you're trying to accomplish,
we might be able to suggest some better approaches.
Phil
_______________________________________________
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