Side effect (computer science)

Posted zzfx

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Side effect (computer science)相关的知识,希望对你有一定的参考价值。

In computer science, a function or expression is said to have a side effect if it modifies some state outside its scope or has an observable interaction with its calling functions or the outside world besides returning a value. For example, a particular function might modify a global variable or static variable, modify one of its arguments, raise an exception, write data to a display or file, read data, or call other side-effecting functions. In the presence of side effects, a program‘s behaviour may depend on history; that is, the order of evaluation matters. Understanding and debugging a function with side effects requires knowledge about the context and its possible histories.[1][2]

Side effects are the most common way that a program interacts with the outside world (people, filesystems, other computers on networks). But the degree to which side effects are used depends on the programming paradigm. Imperative programming is known for its frequent utilization of side effects.

 

https://en.wikipedia.org/wiki/Side_effect_(computer_science)

以上是关于Side effect (computer science)的主要内容,如果未能解决你的问题,请参考以下文章

vuejs-no-side-effects-in-computed-properties

将请求重定向到 Side_Effect 实用程序类

Do not use ‘new’ for side effects

[XState] Use Activities in XState to Run Ongoing Side Effects

什么是函数的side effects, 如何通俗的理解它?

什么是函数的side effects, 如何通俗的理解它?