3 ms·
> the only correct place to call 'eval' is in the implementation of a REPL. Don't forget also: if you're reading uncompiled code from a file, that's an occasio
by kazinator 9y ago
> the only correct place to call 'eval' is in the implementation of a REPL.
Don't forget also: if you're reading uncompiled code from a file, that's an occasion for eval.
- ScottBurson 9y agoThere are a handful of other valid uses, but there are many invalid ones. I recall, a couple of years ago, hearing about a Rails vulnerability caused by some API method calling 'eval' on one of its arguments if it happened to be a string, just as a convenience for some use case. The fact that it did so wasn't even documented. I was left with the impression that most programmers don't understand how to use 'eval', or rather, how and why not to use it.