[
https://issues.apache.org/jira/browse/GROOVY-11964?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Paul King updated GROOVY-11964:
-------------------------------
Description:
Three idioms are common in modern languages but unavailable in Groovy:
* Tail rest binding: {{def (h, *t) = list}} - separate the head from the
remainder. Common in functional code (recursive list traversal, pipeline-style
processing of streams and iterators).
* Map-style destructuring: {{def (name: n, age: a) = person}} - extract named
properties or map keys directly, without intermediate variables.
* Rest in non-tail positions: {{def (*f, last) = list, def (l, *m, r) = list}}
- useful when the boundaries are at the ends rather than the middle.
> Additional multi-assignment forms
> ---------------------------------
>
> Key: GROOVY-11964
> URL: https://issues.apache.org/jira/browse/GROOVY-11964
> Project: Groovy
> Issue Type: Improvement
> Reporter: Paul King
> Priority: Major
>
> Three idioms are common in modern languages but unavailable in Groovy:
> * Tail rest binding: {{def (h, *t) = list}} - separate the head from the
> remainder. Common in functional code (recursive list traversal,
> pipeline-style processing of streams and iterators).
> * Map-style destructuring: {{def (name: n, age: a) = person}} - extract named
> properties or map keys directly, without intermediate variables.
> * Rest in non-tail positions: {{def (*f, last) = list, def (l, *m, r) =
> list}} - useful when the boundaries are at the ends rather than the middle.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)