3 ms·
We've been using Clojure for our web app at work since day 1. The biggest gain by far is the referential transparency[1] built into the core libraries, which ha
by sdegutis 13y ago
We've been using Clojure for our web app at work since day 1. The biggest gain by far is the referential transparency[1] built into the core libraries, which has also been closely adhered to by nearly all third party libraries (with only a few unfortunate outliers). I cannot emphasize enough just how much of a gain this has been.
[1]: http://en.wikipedia.org/wiki/Referential_transparency_(computer_science) http://en.wikipedia.org/wiki/Referential_transparency_(compu...
- platz 13y agoAny posts which explain how the referential transparency built into the core libraries helps? My understanding is that Clojure is impure, so a "partially referentially transparent" design is interesting to me. Or are you just referring to the fact that the core data structures are immutable?
- adambard 13y agoClojure strongly encourages referential transparency (e.g. immutable data structures), but doesn't demand it (e.g. STM). The convention is simply to mark any function with side-effects with a !, which almost all external libraries follow. Without the !, you can have some confidence that a given function is pure, since pure functions are sort of the "default".
- platz 13y agoRuby follows this convention too, I believe; but probably to a lesser extent because it's core types aren't immutable