4 ms·
The whole idea behind eval is to provide textual input. Requiring an AST as input breaks the whole idea - you're just writing code directly in an awkward format
by AstralStorm 4y ago
The whole idea behind eval is to provide textual input. Requiring an AST as input breaks the whole idea - you're just writing code directly in an awkward format.
- rwmj 4y agoYou're avoiding a whole can of exploits: eval 'print ("hello, $some_user_input")'
- dannymi 4y agoeval comes from Lisp, and there, it's not textual input. You give it a quoted form (i.e. an AST) and an environment and it evaluates the form in that environment. > (eval '(display (+ 5 6)) (interaction-environment)) 11