2 ms·
I'd figure that eval is in the same class as goto and for example Pythons vast dynamicness and metaprogramming abilities. Let's call this class the class of ext
by tetha 17y ago
I'd figure that eval is in the same class as goto and for example Pythons vast dynamicness and metaprogramming abilities. Let's call this class the class of extremely powerful programming constructs.
A GOOD programmer can use such an extremely powerful programming construct and write good, readable code with it which just makes you go 'wow, this is ... just clean, and I get what it does in a second', which is nicer than any code one might produce without using these tools, even though everyone knows that this class of control constructs can create a horrible mess.
However, a BAD programmer can take this class of extremely powerful programming constructs, and create a horrible mess which requires more time to understand than a rewrite would take (more than once, probably).
And now, the third fact you need to add into the mix is: Bad programmers usually don't think they are bad programmers. The realization 'I am actually a pretty bad programmer' is one major step on the path to being a good programmer, as absurd as it sounds. Thus, a good programmer will usually not use this class of extremely power programming constructs, because he knows that he will probably produce a mess with them (and probably miss some really nice solutions), while a bad programmer will probably use them happily, thinking he produces clean and nice code (but he is not).
And this is the reason why gotos, evals and mind-bending meta-programming is not always bad, and not always evil, but we must not admit this, because otherwise, everyone will start using it :)
(yes, I am aware that this is some sort of black/white-imaging and the solution is somewhere in the middle for everyone, but it shows the point much nicer)