Live data from Hacker News

Schema for Clojure(Script) Data Shape Declaration and Validation

blog.getprismatic.com

1–10 of 58 posts

Re: Schema for Clojure(Script) Data Shape Declaration and Validation

#3
post #2

Author here. Happy to answer any questions or comments.

You mention generating core.typed annotations from schemas, to allow for some compile-time checking.

I would have thought that this would be extremly hard to automate for non-trivial schemas, or at least that core.typed would have a hard time proving that return values match a schema. Is this only for a subset?

Re: Schema for Clojure(Script) Data Shape Declaration and Validation

#6
post #4

Great stuff, thanks for releasing this. Definitely going to use it soon.

Thanks so much. We spent a long time thinking about how to have the benefits of types in a Clojure-y data-oriented way. The advantage of having Schemas as data is that we can use Clojure code to process them and generate things like Objective-C classes (https://github.com/Prismatic/schema/blob/d82bf0b049fc1205a81...) and Avro specifications. It will be our glue to declarations in other languages.

Re: Schema for Clojure(Script) Data Shape Declaration and Validation

#7
post #2

Author here. Happy to answer any questions or comments.

Hey, I like what you're doing here, I think I'll use this... it gives you a lot of the benefits of a deep type system while being completely orthogonal to the design of the program and without the cognitive overhead of a complex type system.

Also, functional programming is heavily focused on data transformations, which in practice means lots of deeply nested heterogenous data structures... these types of structure are usually tedious to put into a static type system, but your system appears to make it easy.

Re: Schema for Clojure(Script) Data Shape Declaration and Validation

#8
post #5

This is really brilliant, and damned useful. Reminds me of how type declarations provide self documenting code in Haskell. Thanks alot!

Definitely an inspiration. The core utility of Schema is that the declarations are still data and can be utilized in code. I think we'll have some interesting applications of this idea soon...
Post reply on HN