I think the question was how you can access a field in an object through a 
variable holding the name of the field.

Unfortunately (at least in this case, most often it is very fortunate) Nim is a 
statically typed compiled language, so the names of fields aren't really 
accessible at runtime. You could of course achieve similar things through 
meta-programming, but before reaching into that I think it's wise to look at 
what you're actually trying to achieve. What is the problem you're trying to 
solve by doing this? There might be a way to do what you want in a way that's 
more suitable.

Reply via email to