views:

108

answers:

5

It is taught in every computer science class and written in many books that programmers should not use GoTo. There is even an xkcd comic about it. My question is have we reached a point where the same thing can be said about Eval?

Where GoTo is not conductive for program flow and readability, Eval is the same for debugging, and program execution, and design.

Should using Eval have the same stigma as GoTo, and same consequences as in the xkcd comic?

+1  A: 

May be eval hasn't reached the levels of criticism that GoTo reached, but certainly its deprecated!

Mahesh Velaga
+1  A: 

It's only a matter of time before someone publishes a "Eval considered Evil" article!

Sean
followed by the "'Eval considered Evil' considered Evil" article.
bryanjonker
http://diveintomark.org/archives/2002/01/04/eval_is_evil
dan04
+2  A: 

Eval has some fairly serious security concerns; if there's any chance untrusted or user-supplied input can end up in an eval, it's vulnerable.

Jslint will warn about usage of eval() in js code run through it.

Broam
+3  A: 

If anything, it should carry more stigma.

GoTo often creates code that's difficult to maintain. Eval often creates code with security vulnerabilities - that's worse.

Joe Gauterin
A: 

"Exploits of a Mom" indirectly covers eval - malicious code is run by the system due to lack of proper checking.

Andrew Grimm