upvote
> That's why if x is state then f can never be purely idempotent

That is simply not true. f could be, for example, “set x.variable to 7”, which is definitely idempotent.

reply
There's no side effects in f here, so the statement does not apply
reply
Parent said

> State is in practice always subjected to side effects and concurrency.

There was never any claim or assumption regarding f. Maybe the way you interpreted it is what they meant, but it is not what was stated.

reply
you are oversimplifying with your set variable example. the context is complex state management as with online purchases.
reply
Idempotence is a semantically overloaded term in computer science where in functional programming it refers to the same concept as mathematical idempotence it refers to any function leading to the same state in multiple calls as the first.

And yes, in real machines we can't ever have true same states between multiple calls as system time, heat and other effects will differ but we define the state over the abstracted system model of whatever we are modelling and we define idempotency as the same state over multiple calls in that system.

reply
not just heat and system time. the context is about state handled by databases. database content can never be assumed to be identical between to identical operations involving it.

"delete record with id 123" is only idempotent if there is no chance that an operation like "create record with id 123" happened in between.

reply
> *

I wondered about this too. Also, why was it framed in the context of JSON based RPC over HTTP ?

reply
> State is in practice always subjected to side effects and concurrency.

In that mathematical notation typically there is no side effects and those are meant to be pure functions.

reply
deleted
reply