Fork me on GitHub
#clojure-spec
<
2019-05-21
>
Jakub Holý (HolyJak)14:05:37

does (spec.test/instrument) (w/o args) instrument 1. all functions (ie vars) in all namespaces, mine, libs, and clojure? or 2. just the current one? thanks!

Jakub Holý (HolyJak)16:05:48

yeah I read that. So option 1 right?

Jakub Holý (HolyJak)16:05:26

OK I guess I can run it to get the answer ,thx

seancorfield16:05:48

It will instrument all the s/fdefs that have been loaded.

💯 8
seancorfield16:05:48

As an example, clojure.java.jdbc has all its s/fdefs in a separate namespace so the library's functions would only be instrumented by (s/instrument) if you have required the clojure.java.jdbc.specs namespace.

ejelome18:05:08

This might be answered, but I watched Matthias Felleisen's talk about types: "Types are like the Weather, Type Systems are like Weathermen". And I remembered clojure.spec and noticed that it somehow reflects his ideas (putting contracts instead of making a type system for an untyped language, e.g. typed.clojure [which afaik is now discouraged/discontinued] and that type inference is near to impossible to implement in a untyped language like Clojure). So the question is ... is clojure.spec the answer to Felleisen's talk?

Alex Miller (Clojure team)18:05:10

no, although spec was influenced by Racket's contracts, along with other stuff

Alex Miller (Clojure team)18:05:18

spec had been in development for about 4 months at the time of that talk

seancorfield18:05:11

"typed.clojure [which afaik is now discouraged/discontinued]" -- I thought Ambrose was still actively working on this...?

Alex Miller (Clojure team)18:05:18

he just defended his dissertation on it

Alex Miller (Clojure team)18:05:37

so it has been, but not sure where it's going from here. would be a good question for him

Alex Miller (Clojure team)18:05:26

iirc, while I was away at Clojure/west when that talk was given, Rich wrote all the regex stuff in spec

ejelome18:05:33

thanks @alexmiller, although it didn't came directly from racket's contracts, I'm still glad that they're going almost on the same direction (no type inference, or implementing a type system [just to say we also can do type checking]).

Alex Miller (Clojure team)18:05:35

well, it's not type checking, and the difference is important

Alex Miller (Clojure team)18:05:50

type checking is about proving things early

Alex Miller (Clojure team)19:05:06

spec is about verifying predicative constraints dynamically