Clear questions and runnable code
get the best and fastest answer
Runtime introspection: What good is it?by BrowserUk (Pope)
|on Jul 06, 2008 at 01:55 UTC||Need Help??|
In the last couple of years there seems to be an increasing interest (or hype) regarding run-time 'reflection' and/or run-time 'introspection'. (Are they the same thing?). I've been googling for the terms and reading, essentially randomly chosen articles and snippets, and opinion seems to range from it being the best thing since sliced bread to the most evil coding technique yet devised.
Update:corrected typos. Including the one stvn pointed out.
There seems to be a lot of discussion of what it can do--in terms of "you can determine the type of something at runtime"--but little on why you would want or need to? And why it must be deferred to run-time?
I'm having trouble seeing past the Ruby/Objective-C think that says: We can do it, and not many can, so let's make much of it, as a desirable or even necessary feature.
Premise: There's nothing that can be done with run-time introspection that cannot be done (better) by compile-time decision taking.
Preferably of the form: I use it to do X, because it's easier/quicker/cleaner/safer/more intuative/more maintainable than the other (please specify) approach I though about/read about/tried.
Pointers to existing discussion (of concrete uses) would also be appreciated. Thanks.
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.