transparency. Referential transparency means that an expression (such as a function call) can be replaced with its value. This requires that the expression is pure, that is to say the expression must be deterministic (always give the same value for the same input) and side-effect free. Temporal side effects Side effects caused by the time taken for an operation to execute are usually ignored when discussing side effects and referential transparency. There are some cases, such as with hardware timing or testing, where operations are inserted specifically for their temporal side effects e.g. sleep(5000) or for (int i = 0; i < 10000; ++i) {}. These instructions do not change state other than taking an amount of time to complete. Idempotence A subroutine with side effects is idempotent if multiple applications of the subroutine have the same effect on the system state as a single application, in other words if the function from the system state space to itself associated with the subroutine is idempotent in the mathematical sense. For instance, consider the following Python program: x = 0 def setx(n): global x x = n setx(3) assert x == 3 setx(3) assert x == 3 setx is idempotent because the second application of setx to 3 has the same effect on the system state as the first application: x was already set to 3 after the first application, and it is still set to 3 after the second application. A pure function is idempotent if it is idempotent in the mathematical sense. For instance, consider the following Python program: def abs(n): return -n if n < 0 else n assert abs(abs(-3)) == abs(-3) abs is idempotent because the second application of abs to the return value of the first application to -3 returns the same value as the first application to -3. Example One common demonstration of side effect behavior is that of the assignment operator in C. The assignment a = b is an expression that evaluates to the same value as the expression b, with the side effect of storing the R-value of b into the L-value of a. This allows multiple assignment: a = (b = 3); // b = 3 evaluates to 3, which then gets assigned to a Because the operator right associates, this is equivalent to a = b = 3; This presents a potential hangup for novice programmers who may confuse while