You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: blog/2024-12-24-nushell_0_101_0.md
+66-7Lines changed: 66 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -48,8 +48,63 @@ As part of this release, we also publish a set of optional plugins you can insta
48
48
49
49
## Breaking changes
50
50
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
+
51
102
## Deprecations
52
103
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
+
53
108
## Removals
54
109
55
110
## Bug fixes and other changes
@@ -84,14 +139,18 @@ Thanks to all the contributors below for helping us solve issues, improve docume
84
139
<!-- | [@Bahex](https://github.com/Bahex) | lsp and --ide-check fix for `path self` related diagnostics | [#14538](https://github.com/nushell/nushell/pull/14538) | -->
85
140
<!-- | [@Beinsezii](https://github.com/Beinsezii) | command/http/client use CRLF for headers join instead of LF | [#14417](https://github.com/nushell/nushell/pull/14417) | -->
|[@IanManske](https://github.com/IanManske)| Change append operator to concatenation operator |[#14344](https://github.com/nushell/nushell/pull/14344)|
145
+
89
146
<!-- | [@IanManske](https://github.com/IanManske) | Make `Hooks` fields non-optional to match the new config defaults | [#14345](https://github.com/nushell/nushell/pull/14345) | -->
<!-- | [@IanManske](https://github.com/IanManske) | Make `timeit` take only closures as an argument | [#14483](https://github.com/nushell/nushell/pull/14483) | -->
0 commit comments