The former, of course. It's value semantics: two distinct variables are always independent of one another. a and b are two separate documents.

That is, are these mutations serialized or not?

The mutations are serialized after any previously issued mutations to a, but not serialized with respect to one another.

If they are one actor, we have reintroduced some form of reference semantics. If they are two, providing serialization would violate the formal notion that mutations on value types are copy-in/copy-out (some day to be move-in/move-out).

I don't see any problem here.

what if one of the pending tasks at the time of a copy has side effects?

The semantics have to be “as-if” the copy is only made after all the pending tasks have executed. That could be implemented at least two ways I can think of: the current task is suspended at the point of the copy until a's queue is empty (crude) or the system makes it so b can't be read until a's queue has caught up to where it was copied.

I don't see how this brings up any unique problems with side-effects.

8 Likes