Function

open class Function<A1, A2, A3, A4, A5, A6, A7, A8, A9, R>

Feather uses this to hold function objects. i.e. functions are first class citizens in Feather (they aren't in Java). You can assign a function to a variable, and pass functions into other functions/methods.

Parameter types A1..A9 are the function's parameter types. For functions with fewer than 9 parameters, the later ones are of type [Void].

Note that functions with more than 9 arguments are not supported. This means methods with more than 8 arguments are not supported, as the first argument will be the object whose method we are calling.

R is the return type.

For example, the type : . (String->int) Will be of type : FunctionPrimitive types ARE allowed in A1..9 and R. This is kind of illegal, but type erasure means that the generic type won't be in the compiled code ;-) NOTE, This is not in package uk.co.nickthecoder.feather.runtime, because that package is safe to include in Feather's sandbox, whereas this classes may not be safe.

Constructors

Link copied to clipboard
constructor(method: Method)
Called by FunctionStackEntry, which also looks up the [Method] in hard-coded bytecode.

Functions

Link copied to clipboard
open fun curry(arg: A1): Function<A2, A3, A4, A5, A6, A7, A8, A9, Void, R>
Curries the function.
open fun curry(arg1: A1, arg2: A2): Function<A3, A4, A5, A6, A7, A8, A9, Void, Void, R>
Curry two arguments
open fun curry(arg1: A1, arg2: A2, arg3: A3): Function<A4, A5, A6, A7, A8, A9, Void, Void, Void, R>
Curry three arguments
open fun curry(arg1: A1, arg2: A2, arg3: A3, arg4: A4): Function<A5, A6, A7, A8, A9, Void, Void, Void, Void, R>
Curry four arguments
open fun curry(arg1: A1, arg2: A2, arg3: A3, arg4: A4, arg5: A5): Function<A6, A7, A8, A9, Void, Void, Void, Void, Void, R>
Curry five arguments
Link copied to clipboard
open fun invoke(args: Array<Any>): R
Invokes (calls) the function.