eval
Sign in to saveIn some programming languages, eval, short for evaluate, is a function which evaluates a string as though it were an expression in the language, and returns a result; in others, it executes multiple lines of code as though they had been included instead of the line including the eval. The input to eval is not necessarily a string; it may be structured representation of code, such as an abstract syntax tree (like Lisp forms), or of special type such as code (as in Python). The analog for a statement is exec, which executes a string (or code in other format) as if it were a statement; in some la
In the Vinony graph
Within Vinony's link graph, eval is referenced by 43 other articles, and connects out to Lisp, Xojo and PHP.
It sits within the topics Control flow, IBM i Qshell commands and Unix SUS2008 utilities.
Its subject is documented across 9 Wikipedia language editions.
Wikidata facts
- Instance of
- function
Show 1 more fact
- Stack Exchange tag
- stackoverflow.com/tags/eval
Sources (1)
via Wikidata · CC0
~17 min read
Encyclopedic overview
31 sectionsContents
- Security risks
- Implementation
- Programming languages
- ECMAScript
- JavaScript
- ActionScript
- Lisp
- Perl
- PHP
- Lua
- PostScript
- Python
- D
- ColdFusion
- Ruby
- Forth
- BASIC
- REALbasic
- VBScript
- Visual Basic for Applications
- Smalltalk
- Tcl
- bs
- Command-line interpreters
- Unix shells
- PowerShell
- Microcode
- Theory
- See also
- References
- External links
In some programming languages, eval, short for evaluate, is a function which evaluates a string as though it were an expression in the language, and returns a result; in others, it executes multiple lines of code as though they had been included instead of the line including the eval. The input to eval is not necessarily a string; it may be structured representation of code, such as an abstract syntax tree (like Lisp forms), or of special type such as code (as in Python). The analog for a statement is exec, which executes a string (or code in other format) as if it were a statement; in some languages, such as Python, both are present, while in other languages only one of either eval or exec is.
== Security risks == Using eval with data from an untrusted source may introduce security vulnerabilities. For instance, assuming that the get_data() function gets data from the Internet, this Python code is insecure:
Excerpted from Wikipedia’s “eval” article, available under the CC BY-SA 4.0 licence.