Raxol.REPL.Evaluator
(Raxol v2.3.0)
View Source
Elixir code evaluator with timeout protection, IO capture, and persistent bindings.
Each evaluator maintains its own binding context across evaluations, so variables defined in one eval call are available in the next.
evaluator = Evaluator.new()
{:ok, result, evaluator} = Evaluator.eval(evaluator, "x = 1 + 2")
{:ok, result, evaluator} = Evaluator.eval(evaluator, "x * 10")
result.value #=> 30
Summary
Functions
Returns the list of current variable bindings as [{name, value}].
Clears evaluation history, keeping bindings.
Evaluates code in the evaluator's binding context.
Returns evaluation history as [{code, result}], newest first.
Creates a new evaluator with an empty binding context.
Resets all bindings, keeping history.
Types
Functions
Returns the list of current variable bindings as [{name, value}].
Clears evaluation history, keeping bindings.
Evaluates code in the evaluator's binding context.
Returns {:ok, result, new_evaluator} on success or {:error, reason, evaluator} on failure.
Bindings persist across calls. IO output is captured separately from the return value.
Returns evaluation history as [{code, result}], newest first.
Creates a new evaluator with an empty binding context.
Resets all bindings, keeping history.