Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Effect system
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
== Examples == Some examples of the behaviors that can be described by effect systems include: * Reading, writing or allocating memory: the effect kind is ''read'', ''write'', ''allocate'' or ''free'', and the region is the point of the program where allocation was performed (i.e., each program point where allocation is performed is assigned a unique label, and region information is statically propagated along the dataflow). Most functions working with memory will actually be polymorphic in the region variable: for example, a function that swaps two locations in memory will have type {{code|forall r1 r2, unit ! {{mset|read r1, read r2, write r1, write r2}}}}. * Working with resources, such as files: for example, the effect kind may be ''open'', ''read'' and ''close'', and again, the region is the point of the program where the resource is opened. * Control transfers with continuations and long jumps: the effect kind may be ''[[goto]]'' (i.e. the piece of code may perform a jump) and ''[[comefrom]]'' (i.e. the piece of code may be the target of a jump), and the region denotes the point of the program from which or to which the jump may be performed. From a programmer's point of view, effects are useful as it allows for separating the implementation (''how'') of specific actions from the specification of what actions to perform. For example, an ''ask name'' effect can read from either the console, pop a window, or just return a default value. The control flow can be described as a blend of [[Generator (computer programming)|''yield'']] (in that the execution continues) and [[Exception handling|''throw'']] (in that an unhandled effect propagates down until handled).<ref>{{cite web |last1=Abramov |first1=Dan |title=Algebraic Effects for the Rest of Us |url=https://overreacted.io/algebraic-effects-for-the-rest-of-us/ |website=overreacted.io |language=en}}</ref>
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)