我的雲端生活網 - Life+

Monday, March 19, 2007

Side effect 的意義

you are able to modify “global” variables
from within a function. This is a side effect because the modification of this global
variable is not related to the output produced by the function. Furthermore, modifying
the state of the real world is considered a side effect: printing something to the screen,
reading a file, etc., are all side effecting operations. Functions that do not have side effects are called pure.

由這個觀點看來haskell & erlang 都應是被稱為 pure functional language

No comments:

Blog Archive