Why exactly is eval evil?

前端 未结 12 1478
没有蜡笔的小新
没有蜡笔的小新 2020-11-22 09:51

I know that Lisp and Scheme programmers usually say that eval should be avoided unless strictly necessary. I’ve seen the same recommendation for several program

12条回答
  •  悲哀的现实
    2020-11-22 10:29

    "When should I use eval?" might be a better question.

    The short answer is "when your program is intended to write another program at runtime, and then run it". Genetic programming is an example of a situation where it likely makes sense to use eval.

提交回复
热议问题