News for hackers. Stuff that matters.
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"?
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?
Re:Software Engineering principles to make teams better by sokoloff on Wednesday June 30, 2021 @09:27PM (#27695425)
And potentially changing the contents of processor caches.
Re:Software Engineering principles to make teams better by zomglings on Wednesday June 30, 2021 @03:12PM (#27692381)
Opening Schrodinger's box isn't side-effect free. :)