3 ms·
> How do you deal with lack of types? Not GP but I'm using Clojure for both the front-end (ClojureScript) and the "back-end" (server running Clojure), sharing
by TacticalCoder 2y ago
> How do you deal with lack of types?
Not GP but I'm using Clojure for both the front-end (ClojureScript) and the "back-end" (server running Clojure), sharing Clojure code between the two.
Clojure is not typed but I use Clojure specs. It's not a type system but it's really nice. You can spec everything, including specc'ing functions: for example you can do stuff like: "while in dev, verify that this function returns indeed a collection that is actually sorted everytime it is called". I'm not saying: "no types + clojure specs" beats types but it exists and it helps to solve some of the things types are useful for.
https://clojure.org/guides/spec https://clojure.org/guides/spec
- anhner 2y ago> _for example you can do stuff like: "while in dev, verify that this function returns indeed a collection that is actually sorted everytime it is called"._ This sounds interesting. Do I understand correctly, this checks the "spec" at runtime? What happens if a spec fails?