top | item 8683632

Ask HN: Do you consider reflection harmful?

6 points| StrykerKKD | 11 years ago | reply

For me reflection is kind of like a magic trick, because it can hide how the program flows. Kind of like the hat-trick, where the input is the empty hat and the output is the bunny and the how remains a mystery.

2 comments

order
[+] api|11 years ago|reply
Not at all, but typically languages that support reflection are slower for very difficult to escape reasons. Chief among these is that such languages are dynamic, making every function call an indirection (load/call). This forces a CPU pipeline flush for each function call, etc. It's theoretically possible to get around this with very smart JITs, but it's very difficult and depending on how dynamic the language is and how these semantics are used it can have severe limitations.
[+] rwallace|11 years ago|reply
Reflection is like profanity: it has legitimate uses, but excessive and gratuitous use thereof should be frowned on. Save it for when you mean it.