logoalt Hacker News

cocototoday at 10:04 AM1 replyview on HN

In your example, idempotency means same request + same state = same response. State becomes part of the request, that’s why it is hard.


Replies

shiandowtoday at 10:11 AM

That's just deterministic behaviour.

For idempotency you literally just want f(state) = f(f(state)). Whether you achieve this by just doing the same thing twice (no external effects) or doing the thing exactly once (if you do have side effects) is not important.

But if you have side effects and need something to happen exactly once it seems a lot more useful to communicate this, rather than pretending you did the thing.

show 3 replies