This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-07-01
Channels
- # 100-days-of-code (2)
- # beginners (83)
- # calva (3)
- # cider (98)
- # clara (3)
- # clj-kondo (2)
- # clojure (84)
- # clojure-dev (59)
- # clojure-europe (11)
- # clojure-italy (22)
- # clojure-madison (4)
- # clojure-nl (3)
- # clojure-spec (24)
- # clojure-uk (80)
- # clojurescript (33)
- # clr (3)
- # datomic (59)
- # events (2)
- # fulcro (20)
- # interop (35)
- # jobs (6)
- # jobs-rus (1)
- # joker (3)
- # kaocha (2)
- # luminus (3)
- # off-topic (16)
- # other-languages (2)
- # pathom (17)
- # planck (2)
- # reagent (1)
- # shadow-cljs (1)
- # test-check (1)
- # tools-deps (49)
- # vim (16)
new test.check release: https://clojurians.slack.com/archives/C0JKW8K62/p1561995125014300
Updated our code at work to use 0.10.0-RC1
and to switch away from the deprecated generators -- and we were using pos-int
on the assumption that it generated strictly positive numbers (although zero doesn't break our tests).
that makes me glad I deprecated it ๐
did you switch to (gen/fmap inc gen/nat)
, or something else?
For now we just switched to gen/nat
to preserve the behavior but we will revisit that test and see what might happen if it ever generates zero. At least it is clear now!
I can assure you it generates zero quite often ๐
That test should probably fail with zero (but it doesn't) ๐
computers are crazypants
@gfredericks What's the thinking behind deprecating those generators?
pos-int
and neg-int
are highly misleading w.r.t. 0, and all five of them are misleading w.r.t. size; I think generators by default should generate a healthy range of things, and if you want to restrict yourself to small numbers you should have to be explicit
so it's basically entirely a naming issue
spose I could've also deprecate-renamed gen/ratio
to gen/small-ratio
Are you actually planning to remove them at some point (a breaking change) or just "strongly discourage" their usage?
there's already another deprecated generator of that sort
I found 15 occurrences of "deprecated" in that file ๐
(seven functions)
entirely for naming, apparently:
(def ^{:deprecated "0.6.0"}
char-alpha-numeric
"Deprecated - use char-alphanumeric instead.
Generates alphanumeric characters."
char-alphanumeric)
Naming is hard. I struggled with deprecation/breakage in clojure.java.jdbc
and ended up breaking the API twice to get it consistent and idiomatic. With hindsight I would have done it differently.
yeah I've tried to figure out how to overhaul things so many times, and largely haven't
Does spec have a simple way to express xor
with map keys? Meaning map m
can have key :a
or key :b
, but not both.
Has someone a solution for using st/instrument
with :stub
were the function is called more than once and I like to have return values depending on the inputs? With Java mock frameworks such things are possible. With spec I donโt have an idea how to do it. Thanks!
You canโt with stub, but you could make a stateful :replace fn
@alexmiller Work perfect. Thanks! Not as elegant like mock libs but one could build a helper function which maps inputs to outputs.
Updated our code at work to use 0.10.0-RC1
and to switch away from the deprecated generators -- and we were using pos-int
on the assumption that it generated strictly positive numbers (although zero doesn't break our tests).