Arbortext Command Language > Functions by Alphabetical Listing > eval (Function)
  
eval (Function)
eval(expr[, package])
This function parses and evaluates the value of the expression expr. The result is returned as a string or number depending on the context. When called from a user-defined function, the expression is compiled within the current scope, so local variables are accessible.
package, if specified, changes the effective package used to evaluate the expression. By default, the current package is used.
If there is a syntax or runtime error, the variable $ERROR gives the error message. If there is no error, then $ERROR is set to the null string. This function does not generate error popup messages. The caller must display the value of $ERROR if desired.
Here is an example of how to call a function whose name is not known until runtime (that is, the value of the variable $funcname is unknown at compilation):
eval("$funcname($$x)")
In this case, the argument is the variable x. The double dollar-sign is not needed if eval is called from the context of a user-defined function.