Re:Software Engineering principles to make teams better
by e40 on Wednesday June 30, 2021 @12:49PM
(#27690733)
And is another way to say this "side-effect free"?
[ Parent
| on HN ]
Re:Software Engineering principles to make teams better
by rcfox on Wednesday June 30, 2021 @01:05PM
(#27690912)
The Linux shell command 'touch foo' is idempotent, but not side-effect free.
Reading a variable shared between threads without a lock is side-effect free but not idempotent.
Re:Software Engineering principles to make teams better
by zomglings on Wednesday June 30, 2021 @03:10PM
(#27692364)
Interestingly, `touch` is not idempotent because it modifies timestamps. Not being pedantic, just an interesting consideration. `mkdir -p` is idempotent, I believe.
Re:Software Engineering principles to make teams better
by mytailorisrich on Wednesday June 30, 2021 @03:20PM
(#27692465)
You're absolutely correct, it's not idempotent for the crucial reason you mention. It's crucial because updating the timestamps is the main purpose of 'touch' in the first place!
Re:Software Engineering principles to make teams better
by omegalulw on Wednesday June 30, 2021 @02:25PM
(#27691898)
Reading a variable isn't side-effect free either :P
Re:Software Engineering principles to make teams better
by rcfox on Wednesday June 30, 2021 @04:01PM
(#27692833)
In the sense that you're moving data in to a register and updating the program counter?