|
|
|
|
|
by twic
3191 days ago
|
|
I understand 'idempotent' not as 'having no side effects' but as 'having the same side effects whether performed one or many times'. This is side-effect free: echo hello
This is side-effectful, but idempotent: echo hello >world
This is side-effectful and not idempotent: echo hello >>world
|
|
In the hello world example, I guess we are considering 'echo' as the function. If then if we consider stdout and echo's args to be the same, echo will be idempotent.
However, stdout and command args are pretty different things on any system I know. If we care about things like command line history, then clearly 'echo hello world' is not idempotent.