roam/20210310182256-side_effects.org

17 lines
887 B
Org Mode
Raw Permalink Normal View History

2021-07-29 22:51:04 +00:00
:PROPERTIES:
:ID: 0e092b64-dcaf-4579-9de8-0da3ede9dc53
:END:
2021-03-11 00:15:23 +00:00
#+title: Side Effects
2021-07-29 22:51:04 +00:00
In [[id:9e68d422-cced-4177-96d1-90f777b9a493][Software Development]], the effects of running a function or bit of code
2021-03-11 00:15:23 +00:00
outside of its local environment. Examples include reaching out over the network
to talk to a database, reading or writing a file on disk, or printing some
2021-07-29 22:51:04 +00:00
output. This contrasts with [[id:ec68f43a-7c63-4e22-81f9-b119791a6dd1][Purity]], where such effects are not allowed.
2021-03-11 00:15:23 +00:00
Effectful code has implicit, rather than explicit, state. This is to say, the
behavior of the code may differ not based solely on its explicit inputs, but
also values at a higher level of scope, the stability of the network, or the
current contents of a file. They may also impact external state, which can make
them difficult to reason about and sensitive to the order in which statements
are executed.