Fork me on GitHub
#test-check
<
2018-03-05
>
ghadi17:03:12

@gfredericks what's going on with https://dev.clojure.org/jira/browse/TCHECK-2 ? we just got bit by that

gfredericks17:03:18

what's a good solution w.r.t. not breaking things? deprecate the old poorly named things and make new things with good names?

ghadi17:03:08

i guess i'm confused on how it's poorly named vs broken

ghadi17:03:47

(pos-int? 0) => false

ghadi17:03:03

IIRC it just so happens that spec filters out by doing (such-that pos-int? gen/pos-int) -- but if you use test.check directly you'll see 0

ghadi17:03:42

yeah:

user> (clojure.spec.gen.alpha/sample (clojure.spec.alpha/gen pos-int?))

(1 1 1 4 2 4 31 1 8 4)

user> (clojure.test.check.generators/sample clojure.test.check.generators/pos-int)

(0 0 1 1 0 5 1 2 1 4)

gfredericks18:03:02

I think it was always a case of a bad name; I have no idea where those names came from, but I think the docstrings have reflected the actual behavior

gfredericks18:03:21

so changing the behavior & docstrings to match the names would potentially break anybody using them

ghadi18:03:42

what does the s in s-pos-int mean?

gfredericks18:03:10

"strictly" -- which points even more strongly to the bad names theory

gfredericks18:03:15

there's a relevant section on integer generators here: https://dev.clojure.org/display/design/Generators+Reboot

ghadi18:03:13

in rich's compatibility algebra of provides and requires -- is not returning 0 a breaking change? Is it possible that certain random seeds never see 0?

gfredericks18:03:44

I've wondered about how the compatibility algebra applies to generators and distributions 😄

gfredericks18:03:17

I do think reducing the distribution is a breaking thing

gfredericks18:03:25

you're silently causing users' generators to test less than they used to

ghadi18:03:32

my 2c: this generator is busted and it's not that big of a deal to remove 0. (There is an argument around people relying on behavior whether correct or not)

ghadi18:03:11

i can be persuaded either way -- but not for a crappy name like s-pos-int

gfredericks18:03:54

no I don't think "leave everything as-is" is a good solution

gfredericks18:03:39

given zero is such an important edge case a lot of the time, silently making people's tests less effective is also a bad idea I think

gfredericks18:03:28

I think the bigger question that needs deciding is the one from the link above -- whether to start a new namespace or improve things by deprecating individual generators

gfredericks18:03:47

I feel like rich's paradigm could use some good deprecation tooling

gfredericks19:03:35

woah the spec alias of the exact same name has different behavior?

gfredericks19:03:45

gee willickers

ghadi19:03:23

maybe we should ask Rich on the mailing list

gfredericks19:03:50

about deprecation or about generator aliasing?

ghadi19:03:36

The former

gfredericks19:03:30

like whether deprecation is a good idea at all, or the specific question of how we should do it exactly?

ghadi19:03:11

what to do specifically

ghadi19:03:25

need a third set of eyes