4 ms·
Consider atomically incrementing a variable. You need to both perform the increment, and get the value.
by millstone 6y ago
Consider atomically incrementing a variable. You need to both perform the increment, and get the value.
- brundolf 6y agoYeah, someone else pointed out the async case. I think I just haven't done a ton of async programming so it didn't register on my radar as a major example of this, but I can see how it intrinsically couples value-creation and value-mutation together. The crux is that you can't deterministically know how the operation will go until you try it, and you therefore have to return some information about the operation itself which can't just be derived in a pure way from the state of things before or after the operation.