When is `eval` in Ruby justified?

后端 未结 8 1578
太阳男子
太阳男子 2020-11-27 18:14

\"Is \'eval\' supposed to be nasty?\" inspired this one:

Mostly everybody agrees that eval is bad, and in most cases there is more elegant/safer replace

8条回答
  •  时光取名叫无心
    2020-11-27 19:13

    eval is a tool, it is neither inherently good nor evil. It is justified whenever you are certain it is the right tool for what you are trying to accomplish.

提交回复
热议问题