5 ms·
This is an important move for the Clojure language. As with all dynamic languages, and exarcerberated by the fact that it encourages relying on data first - as
by pyritschard 10y ago
This is an important move for the Clojure language. As with all dynamic languages, and exarcerberated by the fact that it encourages relying on data first - as opposed to say, classes in other languages - Clojure puts the onus on the developer to catch errors in data.
The clojure community as a whole embraced prismatic's schema as a way to provide occurence typing for data. Since library authors often tend to reduce their dependency surface, most libraries do not ship with it though.
With the inclusion of this in clojure core, it will now be possible to provide occurence typing at the edge of functions instead of tracking malformed input deep inside apps.
The racket-type contract notation is also a very welcome change from other similar approaches in my opinion.
[1]: https://github.com/plumatic/schema https://github.com/plumatic/schema
- gshayban 10y agoAgreed that this is a big step, but what is being included in core is very distinct from Prismatic Schema. For example the way keysets vs values are handled is intentionally different from schema. The rationale is a good read.
- pyritschard 10y agoYes, I've read and see the difference from schema. The huge advantage with this, is that even though the approach is different, it supersedes schema's abilities and it will be a require away for every library and application author.
- jrcii 10y ago> The rationale is a good read. Hickey's design choices consistently appear to be exceptionally well reasoned.
- solipsism 10y agoIt's because of the hammock time.
- pyritschard 10y agoThe code has just landed [1]. It's not a .cljc file yet, but fingers crossed this becomes a thing at some point. [1]: https://github.com/clojure/clojure/commit/3394bbe616c6202618983ec87185a3ed25d0f557 https://github.com/clojure/clojure/commit/3394bbe616c6202618...
- puredanger 10y agoIt will not be a cljc file, but it will be added to ClojureScript too.