From ec3cebb068a3bc13b77e3dde51ee0ea2c247efbf Mon Sep 17 00:00:00 2001 From: Ian Manske Date: Sun, 15 Dec 2024 14:30:54 -0800 Subject: [PATCH] Add notes for (most) of my PRs --- blog/2024-12-24-nushell_0_101_0.md | 73 +++++++++++++++++++++++++++--- 1 file changed, 66 insertions(+), 7 deletions(-) diff --git a/blog/2024-12-24-nushell_0_101_0.md b/blog/2024-12-24-nushell_0_101_0.md index 41c034ad8b..5bcf882b13 100644 --- a/blog/2024-12-24-nushell_0_101_0.md +++ b/blog/2024-12-24-nushell_0_101_0.md @@ -48,8 +48,63 @@ As part of this release, we also publish a set of optional plugins you can insta ## Breaking changes +### `++` operator + +The `++` operator previously performed both appending and concatenation. + +```nu +# Appending +[1 2 3] ++ 4 == [1 2 3 4] + +# Concatenation +[1 2 3] ++ [4 5 6] == [1 2 3 4 5 6] +``` + +This created ambiguity when operating on nested lists: + +```nu +[[1 2] [3 4]] ++ [5 6] +# Should this be [[1 2] [3 4] [5 6]] or [[1 2] [3 4] 5 6] ? +``` + +Additionally, the `++=` operator was able to change the type of a mutable a due to its dual role: + +```nu +mut str: string = 'hello ' +($str | describe) == string + +$str ++= ['world'] +($str | describe) == list +``` + +After [#14344](https://github.com/nushell/nushell/pull/14344), the `++` operator now only performs concatenation (between lists, strings, or binary values). To append a value to a list, either wrap the value in a list or use the `append` command. + +```nu +mut list = [1 2] +$list ++= [3] +$list = $list | append 4 +``` + + + +### `timeit` + +The `timeit` command previously had a special behavior where expressions passed as arguments would have their evaluation deferred in order to later be timed. This lead to an interesting bug ([14401](https://github.com/nushell/nushell/issues/14401)) where the expression would be evaluated twice, since the new IR evaluator eagerly evaluates arguments passed to commands. + +To make the deferred evaluation more explicit, the `timeit` command can now only take a closure as an argument instead of any expression or value ([#14483](https://github.com/nushell/nushell/pull/14483)). Additionally, blocks are no longer supported by `timeit`, so any changes to the environment will be isolated to inside the closure. + +### `sys cpu` + +The `cpu_usage` column outputted by `sys cpu` works by sampling the CPU over a 400ms period. This wait long time is unhelpful if you are only interested in other information about the CPU like the number of cores (i.e., `sys cpu | length`). With [#14485](https://github.com/nushell/nushell/pull/14485), the `cpu_usage` column is now gated behind the `--long` flag. This way, `sys cpu` will take around 0-2ms instead of 400ms by default. + ## Deprecations +### `split-by` + +In [#14019](https://github.com/nushell/nushell/pull/14019), the `split-by` command was deprecated. Instead, please use `group-by` with multiple groupers. + ## Removals ## Bug fixes and other changes @@ -84,14 +139,18 @@ Thanks to all the contributors below for helping us solve issues, improve docume - - + +| [@IanManske](https://github.com/IanManske) | Deprecate `split-by` command | [#14019](https://github.com/nushell/nushell/pull/14019) | +| [@IanManske](https://github.com/IanManske) | Change append operator to concatenation operator | [#14344](https://github.com/nushell/nushell/pull/14344) | + - - - - - + +| [@IanManske](https://github.com/IanManske) | Add `Filesize` type | [#14369](https://github.com/nushell/nushell/pull/14369) | +| [@IanManske](https://github.com/IanManske) | Remove `ListStream` type | [#14425](https://github.com/nushell/nushell/pull/14425) | +| [@IanManske](https://github.com/IanManske) | Make `timeit` take only closures as an argument | [#14483](https://github.com/nushell/nushell/pull/14483) | +| [@IanManske](https://github.com/IanManske) | Remove duplicate implementations of `CallExt::rest` | [#14484](https://github.com/nushell/nushell/pull/14484) | +| [@IanManske](https://github.com/IanManske) | Add `--long` flag for `sys cpu` | [#14485](https://github.com/nushell/nushell/pull/14485) | +