LRM 16.9.2 Repetition in sequences mentions ::
In particular, goto repetition and nonconsecutive repetition cannot be applied to a Boolean expression to which a sequence match item (see 16.10, 16.11) has been attached.
For example, the following is a legal sequence expression:
(b[->1], v = e)[*2]
but the following is illegal:
(b, v = e)[->2] // Why is it illegal ?
I was trying to understand the logical reason behind it
One possible reason I can think of ::
LRM 16.10 Local variables mentions ::
The subsequence to which a local variable assignment is attached shall not admit an empty match (see 16.12.22).
For example, the sequence a ##1 (b[*0:1], x = e) ##1 c[*2] // illegal
is illegal because the subsequence b[*0:1] can match the empty word.
As b[->2] is equivalent to ( !b[*0:$] ##1 b )[*2]
and sequence_match_item can’t be attached to empty match