4 ms·
I'm not saying eval does scale, I'm just saying it's not evil. Of course, if I want to actually manipulate the parse tree, I should parse the string first. Bu
by leif 17y ago
I'm not saying eval does scale, I'm just saying it's not evil. Of course, if I want to actually manipulate the parse tree, I should parse the string first. But if I don't need that kind of power, there's no sense in contorting my code to fit into the awkward metaprogramming constraints of <language>.
- raganwald 17y agoI (also) never said it was evil, I said it doesn't scale. But that being said, I have seen many tools start out being used just as you say, benignly, in places where they offer convenience for simple cases. Open classes a/k/a monkey patching falls in this category for me: a tool that works well for certain straightforward cases. However, programmers seem to have a reach that exceeds their grasp of the limitations of their tools, and over time people push the tools right out of their sweet spot and into trouble. That's not the tool or technique's fault, of course. If people want to amend core classes with hundreds of kitchen-sink convenience methods or eval much more complex string manipulations... You might easily say that is the fault of the programmer for making a poor choice.