I generally use reflection for debugging. Reflection can more easily and accurately display objects within the system than an assortment of print applications. In many languages that have first-class functions, you can even call object functions without writing special code.
There is, however, a way to do what you want (ed). Use a hash table. Save the fields with the field name.
If you really wanted to, you could create standard Get / Set functions or create macros that do this on the fly. #define GetX() Get("X") thing.
You could even realize your own imperfect reflection in this way.
For the advanced user, if you can compile the code, it may be possible to enable the generation of debug output and use it for reflection.
davenpcj Sep 21 '08 at 1:18 2008-09-21 01:18
source share