Ah, I see.

Us a NSMutableDictionary where the key is e.g. "Weight" and store a
NSMutableArray as the value.

Am 20.02.2011 um 18:40 schrieb Jeric Batarina:

> I was planning to create an Array whose name is according to the user's input.
> like, if I entered "Weight", the program creates an array for weights.
> 
> On 2/21/11, Dr. H. Nikolaus Schaller <[email protected]> wrote:
>> 
>> Am 20.02.2011 um 17:49 schrieb Jeric Batarina:
>> 
>>> Is it possible to use NSString as the variable to create an
>>> NSMutableArray?
>>> 
>>> My thoughts is that it'd go like this:
>>> 
>>> NSMutableArray [NSString stringWithCString: <variableName>] =
>>> [NSMutableArray new];
>>> 
>>> Any ideas if this'd work?
>> 
>> a) No, because variable names are analyzed by the compilers at compile time
>> (it is not an interpreter)
>> b) What do you need it for? If you think you need it you have some
>> fundamental flaw in your application architecture.
>> c) you can dynamically access instance variables (with fixed name) through
>> KVC. This uses a NSString as the path.
>>    It works because the compiler stores a table of all instance variable
>> names in the executable code.
>> 
>> -- hns
>> 
>> 


_______________________________________________
Discuss-gnustep mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/discuss-gnustep

Reply via email to