In my mind, fspec is no different than fdef.

With fdef you specify what a function does. How do we know it works? - 
generative testing. Wrappers only check individual calls.

Now you say your function returns a fn, and provides an fspec (same as fdef, a 
trio of specs) for that. How do we know the returned fn (which is often 
implemented anonymously, not a named thing we could fdef) works? It’s not a 
different question so it has the same answer - generative testing.

spec is about making sure your programs _work_ *ahead of time* by using 
generative testing, and leaving only application-domain required checks active 
at runtime (i.e. checking your program would otherwise do manually).

Contracts are about making sure your _broken programs fail_ as soon as possible 
at *(production?) runtime*, and do so at considerable runtime cost. If you only 
activate them during testing then quality depends the coverage and ranges of 
your test suite (usually poor).

spec is not a contract system.

Rich

> On May 25, 2016, at 4:05 PM, Ambrose Bonnaire-Sergeant 
> <abonnaireserge...@gmail.com> wrote:
> 
> Rich,
> 
> Can you talk about the design process behind fspec?
> 
> What tradeoffs were in mind for fspec performing gen testing rather 
> than a traditional function contract wrapper a la racket/contract?
> 
> Thanks,
> Ambrose
> 
> On Mon, May 23, 2016 at 5:20 PM, Rich Hickey <richhic...@gmail.com> wrote:
> I did most of the design of spec in a (paper) notebook.
> 
> The rationale tries to capture the salient driving forces.
> 
> If there is a specific question you have I’d be happy to answer.
> 
> Rich
> 
> > On May 23, 2016, at 4:11 PM, Ivan Reese <ivanre...@gmail.com> wrote:
> >
> > Is there anywhere we can read anything about the design process behind 
> > clojure.spec? I took a look at dev.clojure.org / JIRA, but I haven't yet 
> > found anything on the topic.
> >
> > --
> > You received this message because you are subscribed to the Google
> > Groups "Clojure" group.
> > To post to this group, send email to clojure@googlegroups.com
> > Note that posts from new members are moderated - please be patient with 
> > your first post.
> > To unsubscribe from this group, send email to
> > clojure+unsubscr...@googlegroups.com
> > For more options, visit this group at
> > http://groups.google.com/group/clojure?hl=en
> > ---
> > You received this message because you are subscribed to the Google Groups 
> > "Clojure" group.
> > To unsubscribe from this group and stop receiving emails from it, send an 
> > email to clojure+unsubscr...@googlegroups.com.
> > For more options, visit https://groups.google.com/d/optout.
> 
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with your 
> first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
> ---
> You received this message because you are subscribed to the Google Groups 
> "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
> 
> 
> -- 
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with your 
> first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
> --- 
> You received this message because you are subscribed to the Google Groups 
> "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to