Pijul

Why these patches don't commute?

I thought I roughly understood the idea, but when I try to unrecorded this patch I get an error because this one depends on it. Why? :face_with_monocle:

Very good question. The reason is quite subtle: suppose Alice records a patch introducing a line in a paragraph, while Bob deletes that paragraph in parallel. What should happen when they pull each other’s patch?

  • On Bob’s side, it’s easy: the context of Alice’s patch has disappeared, yielding a clear conflict, that is easy to indentify.
  • However, on Alice’s side, things are more complicated, since she has no way to tell that situation apart from the situation where Bob already knows about her patch, and chose to delete all the lines around hers.

This could potentially break patch commutation. The way Pijul solves that is by making Bob’s patch (the patch starting with 8BVkSa… in your example) depend on all the lines around the deletion, allowing Alice to tell whether Bob was aware of her patch when creating his patch.

A different solution would be to not consider missing contexts as conflicts. That would totally work, but would give a different semantics to Pijul.

1 Like

Thanks for the answer! Pretty clear