Hacker News new | ask | show | jobs
by pyritschard 3684 days 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

2 comments

Agreed 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.

Yes, 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.
> The rationale is a good read.

Hickey's design choices consistently appear to be exceptionally well reasoned.

It's because of the hammock time.
The 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/3394bbe616c6202618...

It will not be a cljc file, but it will be added to ClojureScript too.