Files
lix/lix/libcmd/repl.hh
T
eldritch horrors db35aa753b libexpr: de-ptr-ize many Value uses
with thunk state being shareable we no longer need to worry about value
uniqueness, only about value lifetime. this means we can liberally drop
indirections and allocations, passing references instead of pointers or
using stack memory instead of gc-managed memory for some intermediates.

Change-Id: I2d48a6fd57a376d544bd9bd2d05e5420611986d1
2025-10-05 16:22:35 +02:00

42 lines
810 B
C++

#pragma once
///@file
#include "lix/libexpr/eval.hh"
#include "lix/libutil/types.hh"
namespace nix {
struct AbstractNixRepl : NeverAsync
{
typedef std::vector<std::pair<Value, std::string>> AnnotatedValues;
static ReplExitStatus
run(const SearchPath & searchPath,
nix::ref<Store> store,
EvalState & state,
std::function<AnnotatedValues()> getValues,
const ValMap & extraEnv,
Bindings * autoArgs);
static ReplExitStatus runSimple(
EvalState & evalState,
const ValMap & extraEnv);
protected:
EvalState & state;
Bindings * autoArgs;
AbstractNixRepl(EvalState & state)
: state(state)
{ }
virtual ~AbstractNixRepl()
{ }
virtual void initEnv() = 0;
virtual ReplExitStatus mainLoop() = 0;
};
}