Please try using encapsulation before attempting metaprogramming or functional programming.
Exercise:
Find three reasons not to write this kind of code:
myObject."$localVariable".attribute = 42
This kind of code is wrong on so many levels that if Ali G wrote web apps, he'd love it.