BallEngine class

Available extensions

Constructors

BallEngine(Program program, {void stdout(String)?, void stderr(String)?, String stdinReader()?, String envGet(String)?, List<String>? args, bool enableProfiling = false, int maxRecursionDepth = 10000, int? timeoutMs, int? maxMemoryBytes, int maxModules = 100, int maxExpressionDepth = 1000, int? maxProgramSizeBytes, bool sandbox = false, List<BallModuleHandler>? moduleHandlers, ModuleResolver? resolver})

Properties

hashCode → int
The hash code for this object.
no setterinherited
maxExpressionDepth → int
Maximum nested expression evaluation depth.
final
maxMemoryBytes → int?
Maximum approximate memory allocated for Ball values in bytes. null disables memory limit enforcement.
final
maxModules → int
Maximum number of modules accepted in the program.
final
maxProgramSizeBytes → int?
Maximum protobuf binary size accepted for the program. null disables program size enforcement (default — opt-in for trusted runs).
final
maxRecursionDepth → int
Maximum number of nested non-base Ball function calls allowed.
final
moduleHandlers → List<BallModuleHandler>
Registered module handlers consulted by _callBaseFunction.
final
program → Program
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
sandbox → bool
When true, blocks all I/O / process-affecting base functions (file_, dir_, env_get, exit, panic) by throwing BallRuntimeError. Use for evaluating untrusted programs.
final
stderr ↔ void Function(String)
Standard error sink (overridable for testing).
getter/setter pair
stdinReader ↔ String Function()?
Standard input line reader (overridable for testing). null = no stdin.
getter/setter pair
stdout ↔ void Function(String)
Standard output sink (overridable for testing).
getter/setter pair
timeoutMs → int?
Maximum wall-clock execution time in milliseconds for run. null disables timeout enforcement.
final

Methods

callFunction(String module, String function, Object? input) → Future<Object?>
Invoke any ball function by module and function name with input.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
profilingReport() → Map<String, int>
Returns an unmodifiable snapshot of profiling call counts. Keys are std function names; values are invocation counts. Returns an empty map when profiling was not enabled.
run() → Future<Object?>
Execute the program starting from the entry point.
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited