Information about Side Effect (computer Science)
In computer science, a function or expression is said to produce a side effect if it modifies some state in addition to returning a 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 predict.
Imperative programming is known for employing side effects to make programs function. Functional programming in turn is known for its minimization of side effects.
In CPU design, instruction side effects are those instructions which modify internal CPU values without explicitly stating it - for instance, generally the instruction ADD may or may not modify condition variables (carry, zero, overflow, etc). This causes a problem when designing a CPU that has an instruction pipeline and supports instructions with side-effects. Care must be taken to avoid this hazard - it is possible to avoid by limiting the instruction set to instructions without side effects or in the worst case having additional control circuitry to detect the side effects and stall the pipeline if the next instruction depends on the values.
Imperative programming is known for employing side effects to make programs function. Functional programming in turn is known for its minimization of side effects.
In CPU design, instruction side effects are those instructions which modify internal CPU values without explicitly stating it - for instance, generally the instruction ADD may or may not modify condition variables (carry, zero, overflow, etc). This causes a problem when designing a CPU that has an instruction pipeline and supports instructions with side-effects. Care must be taken to avoid this hazard - it is possible to avoid by limiting the instruction set to instructions without side effects or in the worst case having additional control circuitry to detect the side effects and stall the pipeline if the next instruction depends on the values.
Referential transparency
See also
- Denning principles
Computer science, or computing science, is the study of the theoretical foundations of information and computation and their implementation and application in computer systems.
..... Click the link for more information.
..... Click the link for more information.
In computer science, a subroutine (function, method, procedure, or subprogram) is a portion of code within a larger program, which performs a specific task and can be relatively independent of the remaining code.
..... Click the link for more information.
..... Click the link for more information.
An expression in a programming language is a combination of values, variables, operators, and functions that are interpreted (evaluated) according to the particular rules of precedence and of association for a particular programming language, which computes and then
..... Click the link for more information.
..... Click the link for more information.
static variables typically have a broader scope than other variables. Their values may be set at run-time or may change subtly during program execution.
..... Click the link for more information.
For constants
..... Click the link for more information.
In computer science, imperative programming, as contrasted with declarative programming, is a programming paradigm that describes computation as statements that change a program state.
..... Click the link for more information.
..... Click the link for more information.
Functional programming is a programming paradigm that treats computation as the evaluation of mathematical functions and avoids state and mutable data. It emphasizes the application of functions, in contrast with the imperative programming style that emphasizes changes in state.
..... Click the link for more information.
..... Click the link for more information.
instruction pipeline is a technique used in the design of computers and other digital electronic devices to increase their instruction throughput (the number of instructions that can be executed in a unit of time).
..... Click the link for more information.
..... Click the link for more information.
In computer architecture, a hazard is a potential problem that can happen in a pipelined processor. There are typically three types of hazards: data hazards, branching hazards (control hazards), and structural hazards.
..... Click the link for more information.
..... Click the link for more information.
Referential transparency is a property of parts of computer programs. An expression is said to be referentially transparent if it can be replaced with its value without changing the program (in other words, yielding a program that has the same effects and output on the same input).
..... Click the link for more information.
..... Click the link for more information.
In computer programming, a function may be described as pure if both these statements about the function hold:
..... Click the link for more information.
- The function always evaluates the same result value given the same argument value(s).
..... Click the link for more information.
This article is copied from an article on Wikipedia.org - the free encyclopedia created and edited by online user community. The text was not checked or edited by anyone on our staff. Although the vast majority of the wikipedia encyclopedia articles provide accurate and timely information please do not assume the accuracy of any particular article. This article is distributed under the terms of GNU Free Documentation License.
Herod_Archelaus