eval

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.

To remedy this, all data which will be used with eval must be escaped, or it must be run without access to potentially harmful functions.

According to the Flash 8 documentation, its usage is limited to expressions which represent "the name of a variable, property, object, or movie clip to retrieve.

However, once the eval function had been manually compiled it was then used as part of a simple read-eval-print loop which formed the basis of the first Lisp interpreter.

Evaluation of this symbol must yield the function for addition to make the example work as intended.

An example in the Scheme dialect of Lisp (R5RS and later): In Perl, the eval function is something of a hybrid between an expression evaluator and a statement executor.

The only exception is that errors are reported as coming from a call to eval(), and return statements become the result of the function.

PostScript's exec operator takes an operand — if it is a simple literal it pushes it back on the stack.

The Ruby programming language interpreter offers an eval function similar to Python or Perl, and also allows a scope, or binding, to be specified.

However, it is still limited to only understanding the most basic types, so if you have a function that returns a Dictionary or MySpiffyObject, RBScript will be unable to use it.

To support calling of user-defined functions, one must first initialize the control with the AddCode method, which loads a string (or a string resource) containing a library of user-defined functions defined in the language of one's choice, prior to calling Eval.

The following examples and text are from the bs man page as appears in the UNIX System V Release 3.2 Programmer's Manual.

The eval can also be used as a crude form of indirection, as in the following (Note that, in bs, _ (underscore) is the concatenation operator.

In addition, eval preceded by the interrogation operator, ?, permits the user to control bs error conditions.

For example: returns the value zero if there is no file named "XXX" (instead of halting the user's program).

sh(1) – FreeBSD General Commands Manual In PowerShell, the Invoke-Expression Cmdlet serves the same purpose as the eval function in programming languages like JavaScript, PHP and Python.

Example as an expression evaluator: Example as a statement executor: In 1966 IBM Conversational Programming System (CPS) introduced a microprogrammed function EVAL to perform "interpretive evaluation of expressions which are written in a modified Polish-string notation" on an IBM System/360 Model 50.

[7] Microcoding this function was "substantially more" than five times faster compared to a program that interpreted an assignment statement.

[8] In theoretical computer science, a careful distinction is commonly made between eval and apply.

Here, eval (or, properly speaking, apply) together with its right adjoint, currying, form the simply typed lambda calculus, which can be interpreted to be the morphisms of Cartesian closed categories.