Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

His implementation leaves much to be desired, but there are better ways of doing it.

http://pastebin.com/JiEXp6Za



The example is the most simple way I could think of. It should only show that is is possible not what is the perfect solution (if there is any).

Of course you could throw in some runtime reflection and variable function calls to make it more maintainable. However for me it needs to pay of… I don't want to maintain such a system for just a hand full of properties. I like to keep complexity "flat" and so I often stick to the direct language features. But on large projects the code you linked could really come in handy. Thanks. :)




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: