var a = {};
a.__defineGetter__('test',function() {return 5;});
var i ="test";
Is there any other way I can execute the getter other than a[i]; (while using var i to do it)
EDIT:
I was asking ways to use var i to do it. I'll explain the real problem a bit better.
I am using getters on my namespace object to load modules only when needed.
MyNameSpace.__defineGetter__('db',function(){MyNameSpace.loadModule('db');});
Now in this case I am trying to load all modules:
for (var i in MyNameSpace){
MyNameSpace[i];
}
I use google closure compiler on my code and it reduces that loop above to:
for(var i in MyNameSpace);
No modules get loaded. I am trying to "trick" gcc into letting me load the modules.