Fork me on GitHub
#clojure-spec
<
2017-10-05
>
dbushenko07:10:47

do we have any means of specifying records?

mpenet07:10:20

s/keys should just work on them

guy15:10:32

Whats the best way to test a spec'd function that has side effects?

jaymartin16:10:36

@guy I’m not sure about the best way, but mocking can help speed things along if that’s what you’re after. https://github.com/benrady/specific

guy16:10:37

Thanks @jaymartin have you tried it with the latest version of clojure.spec.alpha (17) ?

guy16:10:47

it looks like specific is using alpha13

jaymartin18:10:24

No, I’ve just messed about with it playfully. But the ideas should be rather generic.

guy18:10:07

kk thanks :thumbsup:

aengelberg22:10:20

Is there an equivalent of declare for specs?

aengelberg22:10:50

alternatively, is there a way to disable the check to see if a spec name exists when used in other specs?

aengelberg22:10:11

basically I would like to structure my code in the following order:

(s/def ::x ::y)
(s/def ::y ...)

aengelberg22:10:28

replacing the first ::y with (s/and ::y) seems to work.

bfabry23:10:59

feels kinda odd that it doesn't just work, seeing as most of things in spec are lazy evaluated

Alex Miller (Clojure team)02:10:15

There is a ticket about this. The intent is that it should work

bfabry15:10:59

good to know, thanks alex

aengelberg19:10:55

Oh cool, I'm glad that that is the intent

guy23:10:51

@aengelberg what do you mean

bfabry23:10:37

@guy he means

boot.user=> (s/def ::foo ::bar)
clojure.lang.Compiler$CompilerException: java.lang.Exception: Unable to resolve spec: :boot.user/bar, compiling:(boot.user1422927036988753503.clj:1:1)

guy23:10:13

Sorry im probably being slow

guy23:10:24

he wants to use a different spec and call it something new?

bfabry23:10:41

he wants to say that the spec for ::foo is the same as the spec for ::bar, and it be ok that the spec ::bar has not been defined yet

bfabry23:10:49

@aengelberg when I've wanted that I've just used (s/def ::bar any?)

aengelberg20:10:17

that works too. thanks