mirror of
https://github.com/nushell/nushell.git
synced 2025-08-09 03:34:58 +02:00
Allow for stacks to have parents (#11654)
This is another attempt on #11288 This allows for a `Stack` to have a parent stack (behind an `Arc`). This is being added to avoid constant stack copying in REPL code. Concretely the following changes are included here: - `Stack` can now have a `parent_stack`, pointing to another stack - variable lookups can fallback to this parent stack (env vars and everything else is still copied) - REPL code has been reworked so that we use parenting rather than cloning. A REPL-code-specific trait helps to ensure that we do not accidentally trigger a full clone of the main stack - A property test has been added to make sure that parenting "looks the same" as cloning for consumers of `Stack` objects --------- Co-authored-by: Raphael Gaschignard <rtpg@rokkenjima.local> Co-authored-by: Ian Manske <ian.manske@pm.me>
This commit is contained in:
committed by
GitHub
parent
c90640411d
commit
d8f13b36b1
@ -272,7 +272,7 @@ pub(crate) fn run_repl(
|
||||
let start_time = std::time::Instant::now();
|
||||
let ret_val = evaluate_repl(
|
||||
engine_state,
|
||||
&mut stack,
|
||||
stack,
|
||||
config_files::NUSHELL_FOLDER,
|
||||
parsed_nu_cli_args.execute,
|
||||
parsed_nu_cli_args.no_std_lib,
|
||||
|
Reference in New Issue
Block a user