Remove lazy records (#12682)

# Description
Removes lazy records from the language, following from the reasons
outlined in #12622. Namely, this should make semantics more clear and
will eliminate concerns regarding maintainability.

# User-Facing Changes
- Breaking change: `lazy make` is removed.
- Breaking change: `describe --collect-lazyrecords` flag is removed.
- `sys` and `debug info` now return regular records.

# After Submitting
- Update nushell book if necessary.
- Explore new `sys` and `debug info` APIs to prevent them from taking
too long (e.g., subcommands or taking an optional column/cell-path
argument).
This commit is contained in:
Ian Manske
2024-05-03 00:36:10 +00:00
committed by GitHub
parent ad6deadf24
commit 847646e44e
32 changed files with 133 additions and 867 deletions

View File

@ -98,21 +98,6 @@ fn insert_uses_enumerate_index() {
assert_eq!(actual.out, "[[index, a, b]; [0, 7, 8], [1, 6, 8]]");
}
#[test]
fn insert_support_lazy_record() {
let actual =
nu!(r#"let x = (lazy make -c ["h"] -g {|a| $a | str upcase}); $x | insert a 10 | get a"#);
assert_eq!(actual.out, "10");
}
#[test]
fn lazy_record_test_values() {
let actual = nu!(
r#"lazy make --columns ["haskell", "futures", "nushell"] --get-value { |lazything| $lazything + "!" } | values | length"#
);
assert_eq!(actual.out, "3");
}
#[test]
fn deep_cell_path_creates_all_nested_records() {
let actual = nu!("{a: {}} | insert a.b.c 0 | get a.b.c");

View File

@ -103,13 +103,6 @@ fn update_uses_enumerate_index() {
assert_eq!(actual.out, "[[index, a]; [0, 8], [1, 8]]");
}
#[test]
fn update_support_lazy_record() {
let actual =
nu!(r#"let x = (lazy make -c ["h"] -g {|a| $a | str upcase}); $x | update h 10 | get h"#);
assert_eq!(actual.out, "10");
}
#[test]
fn list_replacement_closure() {
let actual = nu!("[1, 2] | update 1 {|i| $i + 1 } | to nuon");

View File

@ -112,17 +112,6 @@ fn upsert_past_end_of_list_stream() {
.contains("can't insert at index (the next available index is 3)"));
}
#[test]
fn upsert_support_lazy_record() {
let actual =
nu!(r#"let x = (lazy make -c ["h"] -g {|a| $a | str upcase}); $x | upsert h 10 | get h"#);
assert_eq!(actual.out, "10");
let actual =
nu!(r#"let x = (lazy make -c ["h"] -g {|a| $a | str upcase}); $x | upsert aa 10 | get aa"#);
assert_eq!(actual.out, "10");
}
#[test]
fn deep_cell_path_creates_all_nested_records() {
let actual = nu!("{a: {}} | upsert a.b.c 0 | get a.b.c");