public class EvalFunctionWrapper<ReturnType> implements Function<ReturnType>:
Internal wrapper for functions created via eval(). Implements Function<R> to provide invoke() and operator call().
import klyn.reflection
f = eval("""def twice(x as Int) as Int:
return x * 2""")
assert f is Invocable<Int>
print(f(21)) # 42| Modifier and Type | Member | Description |
|---|---|---|
| public readonly property | namename as String: |
No summary. |
| public readonly property | parameterCountparameterCount as Int: |
No summary. |
| public readonly property | returnTypereturnType as String: |
No summary. |
| Modifier and Type | Member | Description |
|---|---|---|
| public | EvalFunctionWrapperEvalFunctionWrapper(name as String,
parameterCount as Int,
returnTypeName as String,
functionPointer as Object): |
Creates a typed wrapper over a function produced by `eval()`. |
| Modifier and Type | Member | Description |
|---|---|---|
| public | invoke | Invokes the function with dynamic arguments. |
| Modifier and Type | Member | Description |
|---|---|---|
| public | operator call(args as Object[]) as ReturnType throws Exception: | Operator call - enables f(args) syntax. |