After some discussion, we have decided not to drop zeroth group from the groupValues
list, so that the same index value would refer to the same group both in groups
and in groupValues
.
The downside of this decision is that the groupValues
list becomes less convenient for destructuring assignment. An intended way to destructure no longer works:
val (group1, group2) = match.groupValues
, because the first value now is the match value itself and not the first group value.
In order to make destructuring assignment possible, we’re introducing another property MatchResult.destructured
, which only provides component1
, component2
… component10
methods to satisfy the destructuring convention. Thus the usage would be:
val (group1, group2) = match.destructured