Opentopia Directory Encyclopedia Tools

Side effect (computer science)

Encyclopedia : S : SI : SID : Side effect (computer science)


In computer science, a function is said to produce a side effect if it modifies some state other than its return value. For example, a function might modify a global or a static variable, modify one of its arguments, write data to a display or file, or read some data from other side-effecting functions. Side effects often make a program's behavior more difficult to understand.

Imperative programming is known for employing side effects to make programs function. Functional programming in turn is known for its minimization of side effects.

Referential transparency

Being side-effect free is necessary but not sufficient for referential transparency. Referential transparency means that an expression (such as a function call) can be replaced with the value; this requires that the expression has no side effects and is pure (always returns the same results on the same input).

 


From Wikipedia, the Free Encyclopedia. Original article here. Support Wikipedia by contributing or donating.
All text is available under the terms of the GNU Free Documentation License See Wikipedia Copyrights for details.

Search Titles
0123456789
ABCDEFGHIJ
KLMNOPQRST
UVWXYZ?

E-mail this article to:

Personal Message: