Invocation Operator

The invocation operator is used to call a method.

invocation-expression:

primary-expression [< type-listopt >]  ( argument-listopt )

The primary expression in the invocation operator must be a method group or a delegate type value. If the primary expression is a method group, the invocation operator invokes a method. If the primary expression is a delegate value, the invocation operator invokes a delegate. Otherwise, a compile error occurs.

An optional argument list presents values or variable references to be passed as method parameter values. Argument list is specified in round brackets. If there are no arguments, empty brackets are specified.

The language supports universal methods invocation. The optional list of parameter types must include all types assigned to be used in the invoked method. The list of parameter types is enclosed in angle brackets.

NOTE: The current implementation supports invocation of universal methods implemented using other programming languages and stored in imported libraries. The Fore.NET language does not support universal method development.

The result of the invocation operator is classified as follows:

Method Invocation

For a method invocation, the primary expression of the invocation operator must be a method group. The method group identifies the one method to invoke or the set of overloaded methods, from which to choose a specific method to invoke. In the latter case, determination of the specific method to invoke is based on the context provided by the types of the arguments in the argument list.

The compile-time processing of a method invocation of the form M(A), where M is a method group and A is an optional argument list, consists of the following steps:

Delegate Invocation

For a delegate invocation, the primary expression of the invocation operator must be a value of a delegate type. Moreover, considering the delegate type to be a function member with the same parameter list as the delegate type, the delegate type must be applicable with respect to the argument list of the invocation operator.

The runtime processing of a delegate invocation of the form D(A), where D is a primary expression of a delegate type and A is an optional argument list, consists of the following steps:

See also:

Primary Expressions