module invoke
Builtins for invoking Ops and FnDefs.
index
class op_invoke
-
op_invoke\setup(prev)
– Builtin:setup implementation. -
op_invoke\destroy()
– Builtin:destroy implementation. -
op_invoke\eval(scope, tail)
– perform an Op invocation. -
op_invoke\vis()
– Builtin:vis implementation. -
op_invoke.op
– The Op instance.
class fn_invoke
-
fn_invoke\eval(caller_scope, tail)
– evaluate a user-function invocation.
details
class op_invoke
-
– Builtin:setup implementation.
Op:forks the prev's Op instance if given. Creates a new instance otherwise.
parameters:
-
– Builtin:destroy implementation.
calls op:destroy.
-
– perform an Op invocation.
AST:evals the tail, and passes the result to op:setup. Then checks if any of op:all_inputs are dirty, and if so, calls op:tick.
The RTNode contains op, Op.value and all the RTNodes from the tail.
parameters:
- the active scope
- the arguments to this expression
returns:
- (RTNode)
-
– Builtin:vis implementation.
calls op:vis.
returns:
- (table): vis
-
– The Op instance.
class fn_invoke
-
– evaluate a user-function invocation.
Creates a new Scope that inherits from FnDef.scope and has caller_scope as an additional parent for dynamic symbol resolution. Then AST:evals the tail in caller_scope, and defines the results to the names in FnDef.params in the newly created scope. Lastly, AST:clones FnDef.body with the prefix Builtin.tag, and AST:evals it in the newly created Scope.
The RTNode contains the Stream from the cloned AST, and its children are all the RTNodes from evaluating the tail as well as the cloned ASTs.
parameters:
- the active scope
- the arguments to this expression
returns:
- (RTNode): the result of this evaluation