-
-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ambiguity in definitions of purity and side effects #30
Comments
👍 |
PRS are always welcome. Understandability is more important than accuracy in this document so if you can think of a good, simple wording I'm sure it'll get pulled |
Feel free to assign this to me. |
@daira Thank you, please feel free to do a PR. |
Untill now I understood that referencial transparency and purity were the same thing, but it turns out a function can be referentially transparent and have side effects, so it is not pure. Any reason why Referencial Transparency is so far below purity and side-effects? I think the right order of jargons helps alot, and as I understand that I am new to these concepts and haven't used any strictly functional language yet, so feel free to ignore me. |
A side effect is an operation which is not pure. The purity implies the referential transparency (see the confluence of the lambda calculus). A function can also be observationaly pure, but with side effects inside. For example :
We do a mutation |
Interesting classification of effects done in this paper
|
Add totality definition http://alvinalexander.com/photos/totality-rule-functional-programming |
The definitions of purity and side effects are ambiguous. For instance, suppose we have a function that reads, but does modify, state that is reachable from its inputs. Is that a "pure" function? Typically it wouldn't be considered to be pure, but it does not have side effects as-defined, and whether it should be considered to return a value that only depends on its inputs is unclear (since the definition doesn't say that the inputs must be stateless values).
The text was updated successfully, but these errors were encountered: