Re: Can you make a method a variable?
Re: Can you make a method a variable?
- Subject: Re: Can you make a method a variable?
- From: Jeremyah Payne <email@hidden>
- Date: Fri, 6 Feb 2004 07:11:07 -0600
Begin forwarded message:
>
From: Andreas Mayer <email@hidden>
>
Date: February 6, 2004 5:42:08 AM CST
>
To: Jeremyah Payne <email@hidden>
>
Subject: Re: Can you make a method a variable?
>
>
>
Am 06.02.2004 um 10:23 schrieb Jeremyah Payne:
>
>
> Is this better or should i try to make myself a bit clearer?
>
>
That's better. But you should probably re-send this to the correct
>
mailing list address ... ;-)
>
>
I don't think it's a good idea (if even possible) to try and create
>
real obj-c (sub)classes.
>
Instead I'd create a class that represents objects that can replicate
>
and mutate.
>
>
> By having really a different order and combination of some 300
>
> methods they could pick a small group that meets their requests
>
>
In case all those methods have the same parameter(s) (a kind of
>
environment object presumably?) it's easy to pick and store any
>
combination of them. Just use the method names in form of strings.
>
When you need to send the message use one of the performSelector:
>
methods. You can get the selector from a string with
>
NSSelectorFromString() (doh! ;-)).
>
>
So you could store your method names in an array and pick one by
>
random:
>
>
NSArray *coolMethods;
>
>
NSString *ubercoolMethod = [coolMethods
>
objectAtIndex:random()%[coolMethods count]];
>
[self performSelector:NSSelectorFromString(ubercoolMethod)];
>
>
or something like that. :)
>
>
>
bye. Andreas.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.