SE-0414 clarification: examples of isolation regions may be confusing

in SE-0414 there are some examples of isolation regions changing through a program

  1. In these examples of isolation regions, we quote the rules in 3 as written, but in the rule y is the returned value, while in the examples, x is the assigned (returned) value.

assigning a var binding. y = x. Assigning a var binding y with x results in y being in the same region as x. If y is not captured by reference in a closure, then y's previous assigned region is forgotten due to (3)(b):

func mutableBindingAssignmentSimple() {
  var x = NonSendable()
  // Regions: [(x)]
  let y = NonSendable()
  // Regions: [(x), (y)]
  x = y
  // Regions: [(x, y)]
  let z = NonSendable()
  // Regions: [(x, y), (z)]
  x = z
  // Regions: [(y), (x, z)]
}

In contrast if y was captured in a closure by reference, then y's former region is merged with the region of x due to (3)(a).

// Since we pass x as inout in the closure, the closure has to capture x by
// reference.
func mutableBindingAssignmentClosure() {
  var x = NonSendable()
  // Regions: [(x)]
  let closure = { useInOut(&x) }
  // Regions: [(x, closure)]
  let y = NonSendable()
  // Regions: [(x, closure), (y)]
  x = y
  // Regions: [(x, closure, y)]
}

the isolation regions change from (x,y),(z), to (y),(x,z) in combination with the literal rule quote could confuse the readers to think the old isolation group of y was forgotten to achieve this. can we edit this examples? either:

  • changing all the examples to other names like a,b,c
  • swaping x and y
  • clarifying while quoting rule 3 to which variables in the example it applies

can help understanding the examples

  1. rule 3.b itself may be further clarified, maybe with a more complicated example.

If y was not captured by reference, then y's old region is forgotten.

the example changing from (x,y),(z), to (y),(x,z) , doesn't fully explain the meaning of "y's old regoin is forgotten". is the whole region erased (i think not)? or just y taken out of it? (x,y,a),(z) goes to (y),(a),(x,z)or to (y,a),(x,z)? i'm pretty sure the second option is correct, but neighter the rule wording, nor the examples, make me know. Can we change the rule/examples to make it a bit more clear?