Kotlin is introducing name-based destructuring as a replacement for the current position-based approach. A new syntax using `val` inside parentheses (e.g., `(val name, val age) = person`) extracts properties by name rather than position, eliminating bugs from property reordering and improving refactoring safety. A new square-bracket syntax handles positional destructuring for cases like Pairs and collections. Both syntaxes are currently Experimental in Kotlin 2.3.20 via compiler flags. The migration timeline targets Stable status in 2.5.0 (end of 2026), with the old parentheses syntax fully switching to name-based behavior by 2.7.0 (end of 2027). Migration tooling including compiler warnings and IDE quick-fixes will assist the transition.
Table of contents
TL;DRWhy destructure by name instead of position?The new syntaxRepurposing parenthesesThe futureReferences49.8K Impressions