Previous: , Up: Functions   [Index]


9.4 Typeless Anonymous Arguments Functions

The typeless anonymous arguments functions are not unlike the variadic functions in that they allow arguments of unspecified type. The number of the untyped arguments is fixed and they may mix with the ordinary, typed and named arguments.

Pass by reference is also available. Unlike for variadic arguments and like for typed non variadic arguments, the pass by reference for the typeless anonymous arguments is not just a preference indication and the arguments must be passable by reference.

The typeless function parameters are also nameless. The seemingly syntax limitation is an extention of the aime statically typed character: expressions refering typeless parameters cannot be formed because their type cannot be determined statically.

An empty syntax indicates a typeless anonymous function parameter. If the pass by reference is prefered, a single ‘&’ literal sign will describe the parameter.

void
typeless_1(integer a,)
{
}

The function ‘typeless_1’ expects two arguments, the first ‘integer’ convertible, the second of unspecified type.

void
typeless_2(object b,,, text c)
{
}

The function ‘typeless_2’ expects four arguments, the first ‘object’ convertible (virtually any type), the last of intrinsic string type. The second and third allow any type.

void
typeless_3(&,)
{
    set(0, $1);
}

The function ‘typeless_3’ is a generic assignment utility, setting its first argument to the value of its second.

Functions may be both variadic and having fixed typeless anonymous arguments.

void
typeless_4(text &d,, &, real e, ...)
{
}

The function ‘typeless_4’ expects at least four arguments, the first and third passed by reference, the second and fourth by value. After the first four, any number of extra arguments may be passed.

void
typeless_5()
{
}

The function ‘typeless_5’ expects exactly one argument.


Previous: , Up: Functions   [Index]