Next: Lambdas, Previous: Calling Functions, Up: Functions [Contents][Index]
Function types are denoted like:
(type,…)ret_type:
where type are the types of the arguments and ret_type is the type of the value returned by the function.
Optional arguments are marked with a ?
after the type. For
example, the type of the atoi
function with declaration:
fun atoi = (string s, int b = 10) long: { … }
is (string,int?)long:
.
If the function has variadic arguments, the position of the variadic
argument in the function type specifier contains …
. For
example, the type of a printf
function with declaration:
fun printf (string fmt, args…) void: { … }
is (string,…)void:
.