Class TCasScriptWhile

Unit

Declaration

type TCasScriptWhile = class(TCasScriptFunction)

Description

This item has no description.

Hierarchy

Overview

Methods

Public class function ShortName: string; override;
Public class function GreedyArgumentsCalculation: Integer; override;

Description

Methods

Public class function ShortName: string; override;

This item has no description. Showing description inherited from TCasScriptFunction.ShortName.

Short function name, for the parser. This is the name of the function for use in expressions like "function_name(arg_1, arg_2 ... , arg_n)".

This can be an empty string ('') if no explicit name for this function exists. This is useful for operators, which are implemented just like normal functions (a descendant of TCasScriptFunction), but with a special support from parser (e.g. to turn "x + b" into a call to the TCasScriptAdd function).

Public class function GreedyArgumentsCalculation: Integer; override;

This item has no description. Showing description inherited from TCasScriptFunction.GreedyArgumentsCalculation.

Specify which arguments are calculated before function handler is called.

If = -1 (default value returned by implementation in this class) then all arguments are greedily calculated, which simply means that all arguments are calculated before executing function handler. This is the usual and expected behavior of normal functions. It's also a prerequisite for most of overloaded things to work, since we need to know types of calculated arguments (TCasScriptValue classes) before we choose overloaded handler for function.

If this is >= 0, then arguments with index >= of this will not be calculated before handler execution. Since their type is unknown, they will match any type in handler's ArgumentClasses. Your handler will receive Nil in their places, and is responsible for calling their Execute on it's own if needed.

This is particularly suited for implementing control-flow instructions, like "if" and "while", as normal functions inside CastleScript. For example, "if" will have GreedyArgumentsCalculation = 1, so the first argument (condition) will be calculated, but the execution of 2nd or 3rd argument ("then" code or "else" code) will be left to the handler.


Generated by PasDoc 0.16.0-snapshot.