nushell/crates/nu-cmd-base/src
Raphael Gaschignard d8f13b36b1
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>
2024-03-09 17:55:39 +01:00
..
formats Use Record's public API in a bunch of places (#10927) 2023-11-08 14:24:00 +01:00
hook.rs Debugger experiments (#11441) 2024-03-08 20:21:35 +02:00
input_handler.rs Move Value to helpers, separate span call (#10121) 2023-09-03 07:27:29 -07:00
lib.rs Unify glob behavior on open, rm, cp-old, mv, umv, cp and du commands (#11621) 2024-01-26 21:57:35 +08:00
util.rs Allow for stacks to have parents (#11654) 2024-03-09 17:55:39 +01:00