diff options
author | metagn <metagngn@gmail.com> | 2023-12-18 22:34:21 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-12-18 20:34:21 +0100 |
commit | 0613537ca0804e61e6fc9ba3fee5ff68408553a0 (patch) | |
tree | 3cacf4c4b582fddb97b695b2ecb897cf3bd706f4 /changelog.md | |
parent | 941659581add605e8a4ddfc9ff00662aa6234d26 (diff) | |
download | Nim-0613537ca0804e61e6fc9ba3fee5ff68408553a0.tar.gz |
add tuple unpacking changes to changelog (#23093)
closes #23042 Adds changes from #22537 and #22611 to changelog (I believe both are set for 2.2).
Diffstat (limited to 'changelog.md')
-rw-r--r-- | changelog.md | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/changelog.md b/changelog.md index f21ab39da..db85e25a1 100644 --- a/changelog.md +++ b/changelog.md @@ -7,6 +7,12 @@ - The default user-agent in `std/httpclient` has been changed to `Nim-httpclient/<version>` instead of `Nim httpclient/<version>` which was incorrect according to the HTTP spec. - Methods now support implementations based on a VTable by using `--experimental:vtables`. Methods are then confined to be in the same module where their type has been defined. - With `-d:nimPreviewNonVarDestructor`, non-var destructors become the default. +- A bug where tuple unpacking assignment with a longer tuple on the RHS than the LHS was allowed has been fixed, i.e. code like: + ```nim + var a, b: int + (a, b) = (1, 2, 3, 4) + ``` + will no longer compile. ## Standard library additions and changes @@ -38,6 +44,19 @@ slots when enlarging a sequence. - `member` can be used to attach a procedure to a C++ type. - C++ `constructor` now reuses `result` instead creating `this`. +- Tuple unpacking changes: + - Tuple unpacking assignment now supports using underscores to discard values. + ```nim + var a, c: int + (a, _, c) = (1, 2, 3) + ``` + - Tuple unpacking variable declarations now support type annotations, but + only for the entire tuple. + ```nim + let (a, b): (int, int) = (1, 2) + let (a, (b, c)): (byte, (float, cstring)) = (1, (2, "abc")) + ``` + ## Compiler changes - `--nimcache` using a relative path as the argument in a config file is now relative to the config file instead of the current directory. |