Skip to content

Commit ec3cebb

Browse files
committed
Add notes for (most) of my PRs
1 parent ba9f36b commit ec3cebb

File tree

1 file changed

+66
-7
lines changed

1 file changed

+66
-7
lines changed

blog/2024-12-24-nushell_0_101_0.md

Lines changed: 66 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,63 @@ As part of this release, we also publish a set of optional plugins you can insta
4848

4949
## Breaking changes
5050

51+
### `++` operator
52+
53+
The `++` operator previously performed both appending and concatenation.
54+
55+
```nu
56+
# Appending
57+
[1 2 3] ++ 4 == [1 2 3 4]
58+
59+
# Concatenation
60+
[1 2 3] ++ [4 5 6] == [1 2 3 4 5 6]
61+
```
62+
63+
This created ambiguity when operating on nested lists:
64+
65+
```nu
66+
[[1 2] [3 4]] ++ [5 6]
67+
# Should this be [[1 2] [3 4] [5 6]] or [[1 2] [3 4] 5 6] ?
68+
```
69+
70+
Additionally, the `++=` operator was able to change the type of a mutable a due to its dual role:
71+
72+
```nu
73+
mut str: string = 'hello '
74+
($str | describe) == string
75+
76+
$str ++= ['world']
77+
($str | describe) == list<string>
78+
```
79+
80+
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.
81+
82+
```nu
83+
mut list = [1 2]
84+
$list ++= [3]
85+
$list = $list | append 4
86+
```
87+
88+
<!-- A helpful error message will be shown if you try to use `++` to append a value to a list.
89+
TODO: waiting on #14429
90+
-->
91+
92+
### `timeit`
93+
94+
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.
95+
96+
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.
97+
98+
### `sys cpu`
99+
100+
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.
101+
51102
## Deprecations
52103

104+
### `split-by`
105+
106+
In [#14019](https://github.com/nushell/nushell/pull/14019), the `split-by` command was deprecated. Instead, please use `group-by` with multiple groupers.
107+
53108
## Removals
54109

55110
## Bug fixes and other changes
@@ -84,14 +139,18 @@ Thanks to all the contributors below for helping us solve issues, improve docume
84139
<!-- | [@Bahex](https://github.com/Bahex) | lsp and --ide-check fix for `path self` related diagnostics | [#14538](https://github.com/nushell/nushell/pull/14538) | -->
85140
<!-- | [@Beinsezii](https://github.com/Beinsezii) | command/http/client use CRLF for headers join instead of LF | [#14417](https://github.com/nushell/nushell/pull/14417) | -->
86141
<!-- | [@DziubaMaksym](https://github.com/DziubaMaksym) | fix: sample_config | [#14465](https://github.com/nushell/nushell/pull/14465) | -->
87-
<!-- | [@IanManske](https://github.com/IanManske) | Deprecate `split-by` command | [#14019](https://github.com/nushell/nushell/pull/14019) | -->
88-
<!-- | [@IanManske](https://github.com/IanManske) | Change append operator to concatenation operator | [#14344](https://github.com/nushell/nushell/pull/14344) | -->
142+
143+
| [@IanManske](https://github.com/IanManske) | Deprecate `split-by` command | [#14019](https://github.com/nushell/nushell/pull/14019) |
144+
| [@IanManske](https://github.com/IanManske) | Change append operator to concatenation operator | [#14344](https://github.com/nushell/nushell/pull/14344) |
145+
89146
<!-- | [@IanManske](https://github.com/IanManske) | Make `Hooks` fields non-optional to match the new config defaults | [#14345](https://github.com/nushell/nushell/pull/14345) | -->
90-
<!-- | [@IanManske](https://github.com/IanManske) | Add `Filesize` type | [#14369](https://github.com/nushell/nushell/pull/14369) | -->
91-
<!-- | [@IanManske](https://github.com/IanManske) | Remove `ListStream` type | [#14425](https://github.com/nushell/nushell/pull/14425) | -->
92-
<!-- | [@IanManske](https://github.com/IanManske) | Make `timeit` take only closures as an argument | [#14483](https://github.com/nushell/nushell/pull/14483) | -->
93-
<!-- | [@IanManske](https://github.com/IanManske) | Remove duplicate implementations of `CallExt::rest` | [#14484](https://github.com/nushell/nushell/pull/14484) | -->
94-
<!-- | [@IanManske](https://github.com/IanManske) | Add `--long` flag for `sys cpu` | [#14485](https://github.com/nushell/nushell/pull/14485) | -->
147+
148+
| [@IanManske](https://github.com/IanManske) | Add `Filesize` type | [#14369](https://github.com/nushell/nushell/pull/14369) |
149+
| [@IanManske](https://github.com/IanManske) | Remove `ListStream` type | [#14425](https://github.com/nushell/nushell/pull/14425) |
150+
| [@IanManske](https://github.com/IanManske) | Make `timeit` take only closures as an argument | [#14483](https://github.com/nushell/nushell/pull/14483) |
151+
| [@IanManske](https://github.com/IanManske) | Remove duplicate implementations of `CallExt::rest` | [#14484](https://github.com/nushell/nushell/pull/14484) |
152+
| [@IanManske](https://github.com/IanManske) | Add `--long` flag for `sys cpu` | [#14485](https://github.com/nushell/nushell/pull/14485) |
153+
95154
<!-- | [@Jasha10](https://github.com/Jasha10) | enable test_cp_recurse on macos | [#14358](https://github.com/nushell/nushell/pull/14358) | -->
96155
<!-- | [@NotTheDr01ds](https://github.com/NotTheDr01ds) | Load `default_env.nu`/`default_config.nu` before user `env.nu`/`config.nu` | [#14249](https://github.com/nushell/nushell/pull/14249) | -->
97156
<!-- | [@NotTheDr01ds](https://github.com/NotTheDr01ds) | Deprecate `date to-record` and `date to-table` | [#14319](https://github.com/nushell/nushell/pull/14319) | -->

0 commit comments

Comments
 (0)