clj-rethinkdb icon indicating copy to clipboard operation
clj-rethinkdb copied to clipboard

Use clojure.spec for query validation and shaping

Open danielcompton opened this issue 9 years ago • 0 comments
trafficstars

Clojure.spec could be really useful for clj-rethinkdb. Currently we have some functions with ambiguous arities and we need to do adhoc runtime type checking to resolve it. In other cases we just haven't attempted some arities when they could be useful. specing functions would (I think?) allow us to get around this, and provide a more structured way for handling functions with the same arity but different possible behaviours.

Query validation would also be possible. This could be very loose, e.g. making sure the types for each argument are correct, or much more rich, i.e. enforcing that an insert call has been called with a table.

Things to look at:

  • What is the runtime cost of this?
  • Which functions would benefit from this?
  • Do the benefits outweigh the costs?

spec is very new, so we probably wouldn't be merging anything based on this until Clojure released it officially.

danielcompton avatar Jun 06 '16 05:06 danielcompton