Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Use of eval in Python, MATLAB, etc [duplicate]

I do know that one shouldn't use eval. For all the obvious reasons (performance, maintainability, etc.). My question is more on the side – is there a legitimate use for it? Where one should use it rather than implement the code in another way.

Since it is implemented in several languages and can lead to bad programming style, I assume there is a reason why it's still available.

like image 441
magu_ Avatar asked Nov 11 '13 15:11

magu_


1 Answers

First, here is Mathwork's list of alternatives to eval.

You could also be clever and use eval() in a compiled application to build your mCode interpreter, but the Matlab compiler doesn't allow that for obvious reasons.

like image 144
supyo Avatar answered Oct 10 '22 22:10

supyo