load multimethod

Methods

load(bytecode:Str, func_name:Str)
Load compiled bytecode.

Parameters

bytecodecompile() result.
func_nameName of function to create. Used for backtraces and debugging purposes.

Returns

Fun - function with no parameters that runs the loaded bytecode when called.

Example

# From bootstrap.ngs, require() definition
program_text = fetch(fname)
program_bytecode = compile(program_text, fname)
program_func = load(program_bytecode, "require()d file: $fname")
ret = program_func()