summary refs log tree commit diff stats
path: root/changelogs
diff options
context:
space:
mode:
authormetagn <metagngn@gmail.com>2023-03-28 18:52:23 +0300
committerGitHub <noreply@github.com>2023-03-28 17:52:23 +0200
commit2315b01ae691e5e9e54fdfdfb4642c8fbc559e48 (patch)
tree60d0db9a08ff22b375fe44ff8b841264fddefa1f /changelogs
parent4fc9f0c3a3c6f53bfb663e60775e3d7a75c56337 (diff)
downloadNim-2315b01ae691e5e9e54fdfdfb4642c8fbc559e48.tar.gz
tuple unpacking for vars as just sugar, allowing nesting (#21563)
* tuple unpacking for vars as just sugar, allowing nesting

* set temp symbol AST

* hopeful fix some issues, add test for #19364

* always use temp for consts

* document, fix small issue

* fix manual indentation

* actually fix manual

* use helper proc

* don't resem temp tuple assignment
Diffstat (limited to 'changelogs')
-rw-r--r--changelogs/changelog_2_0_0.md20
1 files changed, 20 insertions, 0 deletions
diff --git a/changelogs/changelog_2_0_0.md b/changelogs/changelog_2_0_0.md
index cbe755478..19d97b769 100644
--- a/changelogs/changelog_2_0_0.md
+++ b/changelogs/changelog_2_0_0.md
@@ -343,6 +343,26 @@
 
 - `=wasMoved` can be overridden by users.
 
+- Tuple unpacking for variables is now treated as syntax sugar that directly
+  expands into multiple assignments. Along with this, tuple unpacking for
+  variables can now be nested.
+
+  ```nim
+  proc returnsNestedTuple(): (int, (int, int), int, int) = (4, (5, 7), 2, 3)
+
+  let (x, (_, y), _, z) = returnsNestedTuple()
+  # roughly becomes
+  let
+    tmpTup1 = returnsNestedTuple()
+    x = tmpTup1[0]
+    tmpTup2 = tmpTup1[1]
+    y = tmpTup2[1]
+    z = tmpTup1[3]
+  ```
+
+  As a result `nnkVarTuple` nodes in variable sections will no longer be
+  reflected in `typed` AST.
+
 ## Compiler changes
 
 - The `gc` switch has been renamed to `mm` ("memory management") in order to reflect the