Yes, in mathematics, not programming. And a function that doubles a number isn't idempotent even by that definition.
I think the confusion arises because side-effectful functions can be considered as having type
f :: (RealWorld, OtherArgs) -> (RealWorld, OtherOutputs)
and so for a garage door toggle you have something like t :: RealWorld -> RealWorld
where the new state is the old one with the door opened/closed as appropriate.Now the idempotence condition becomes:
t(t(world)) == t(world)
but clearly t(t(doorOpenWorld)
= t(doorClosedWorld)
= doorOpenWorld
!= t(doorOpenWorld)
= doorclosedWorld
so this is where the notion comes from. If you abuse notation and just say a function of no arguments can be idempotent then you'll get confusion like this.It is a side effect in programming usage (not just HTTP).
Something is side-effect-free if and only if the only result of it running is that you get an answer. If you ignore the answer, then you cannot tell you ran the function/method/call/whatever. PUT is not side-effect-free.
That said, side-effect-free-ness is an incomplete paraphrasing of the HTTP spec (RFC7231); you'll notice that the only mentions of the phrase "side effect" are giving examples of legal side effects.