[Type] Function

Part of: mobl
Inherits from: mobl::Object

Type of a function. Function is in fact a series of types, one for each number of arguments.

Example:

function fun1() { } // type of fun1: Function0<void>
function fun2(n : Num) : String { }
  // type of fun2: Function1<Num,String>

Invocation is done by simply calling.

Example:

function add(n1 : Num, n2 : Num) : Num {
  return n1 + n2;
}
...
var fn : Function2<Num,Num,Num> = add;
fn(1, 2) // -> 3    
mobl/function.txt · Last modified: 2013/10/01 02:28 (external edit)