Use reflection, get better but bigger code?

Monkey Forums/Monkey Programming/Use reflection, get better but bigger code?

MikeHart(Posted 2012) [#1]
A few weeks ago I was implementing something in my framework that I needed reflection for it. As soon as I imported the reflection module and set the reflection filter for my module, syntax errors were shown because of unknown fields and stuff like that during build time. So basically after that, all unused functions/methods were syntax error free.
What I noticed is that now all methods of a class are included in the build, even if you never call them. It this somehow avoidable or is it a prize you have to pay when you use reflection?


ziggy(Posted 2012) [#2]
It is impossible for the compiler to know what you'll be calling dynamicaly at runtime, so that's the price of Reflection. Organizing the code into apropriate files and subfolders can help narrowing this.