discuss-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSMutableArray variable using an NSString???


From: Dr. H. Nikolaus Schaller
Subject: Re: NSMutableArray variable using an NSString???
Date: Sun, 20 Feb 2011 17:58:05 +0100

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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]