

The functional language Haskell eliminates side effects such as I/O and other stateful computations by replacing them with monadic actions. The lack of side effects makes it easier to do formal verification of a program. By contrast, declarative programming is commonly used to report on the state of system, without side effects.įunctional programming aims to minimize or eliminate side effects.
Side effect synonym update#
For example, imperative programming is commonly used to produce side effects, to update a system's state. The degree to which side effects are used depends on the programming paradigm. Side effects play an important role in the design and analysis of programming languages. Understanding and debugging a function with side effects requires knowledge about the context and its possible histories. In the presence of side effects, a program's behaviour may depend on history that is, the order of evaluation matters. Example side effects include modifying a non-local variable, modifying a static local variable, modifying a mutable argument passed by reference, performing I/O or calling other functions with side-effects. In computer science, an operation, function or expression is said to have a side effect if it modifies some state variable value(s) outside its local environment, which is to say if it has any observable effect other than its primary effect of returning a value to the invoker of the operation.

For similar uses, see hidden variable (disambiguation).
