Method Abstract():eval() Foundation

Evaluates a code block.

Syntax
:eval( <bBlock>, [<ExpressionList,...>]) --> xLastValue
Parameters
<bBlock>
<bBlock> is a code block whose program code is executed.
<ExpressionList,...>
<ExpressionList,...> is a list of expressions whose values are passed to the code block as parameters.
Return

The return value of :eval() is the value of the last expression in the program code of <bBlock>. :eval() can thus return a value with any data type.

Description

The :eval() method has the PROTECTED: attribute which means that it can only be called within methods of a class. It is used in the same way as the Eval() function, i.e. method and function evaluate a code block and pass parameters on to it. The difference between Eval() function and :eval() method lies in the accessibility of member variables within the code block. If member variables are declared with the HIDDEN: or PROTECTED: attribute, they cannot be accessed in a code block when it is executed using the Eval() function. This results from the fact that the function provides no method context when it evaluates the code block. In contrast, the method context stays intact when a code block is passed to the :eval() method. This way, the accessibility of hidden or protected member variables within the code block follows the same rules as for accessing member variables in methods of the class.

Feedback

If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.