This seems like a very sensible addition. It uses a familiar idiom to add an operation that may not see everyday use, but is definitely in the category of "it ought to be possible".
One question. I see that the methods and their arguments are rethrows
/throws
respectively, but the semantics of throwing don't seem to be specified. As with _modify
accessors that seems both important and potentially intricate.
Relatedly, the question "Can I cancel the operation?" also occurred to me while reading.
I assume that throwing is how one cancels the modification. If so, this should be added to the docs. And more, I think the exact semantics should be written out -- i.e., if I throw after assigning to the closure's argument, does that abort the write back to the collection? (Presumably not.)