speculative

https://github.com/borkdude/speculative
alexmiller 2018-11-14T17:10:07.001Z

latest Clojure release is 1.10.0-beta5 btw (yes, that’s confusing)

alexmiller 2018-11-14T17:10:42.001600Z

there have been some mild changes in the error reporting in latest

alexmiller 2018-11-14T17:11:29.002100Z

you can actually simplify that arg check to (<= start end (count s)) I think

borkdude 2018-11-14T17:12:30.002300Z

gist updated to beta5: https://gist.github.com/borkdude/445868b6941e7c55adb27d616e052587

borkdude 2018-11-14T17:13:39.002800Z

yes, thanks

alexmiller 2018-11-14T17:16:03.003200Z

what do y’all think of the spec message changes in 1.10?

borkdude 2018-11-14T17:20:29.004200Z

is there a list of improvements? I’d have to change to 1.9.0 and run this example again 🙂

borkdude 2018-11-14T17:27:13.005300Z

I think the errors in 1.10 are clearer in this gist. there may be much more I’m not aware of.

slipset 2018-11-14T17:34:27.007200Z

@alexmiller with the changes you’ve done now, it’s really hard to complain about the error messages.

alexmiller 2018-11-14T17:34:29.007300Z

I think you should run it with 1.9 and compare

alexmiller 2018-11-14T17:34:39.007700Z

the improvement is vast imo

slipset 2018-11-14T17:34:54.008200Z

Which really sucks, cause now we’re gonna have to find something else to complain about.

slipset 2018-11-14T17:35:22.009Z

I guess we still have startup time. And the thing with clojure.set 😛

borkdude 2018-11-14T17:35:39.009400Z

the gist has 1.10 and 1.9 now

slipset 2018-11-14T17:35:58.009900Z

But seriously. The improvements are huge!

alexmiller 2018-11-14T17:35:59.010Z

there are known things to work on

alexmiller 2018-11-14T17:36:20.010500Z

but I think we really made a lot of progress, in a very satisfyingly methodical way

alexmiller 2018-11-14T17:36:55.011400Z

in that we spent a lot of time thinking about it and coming up with guidelines that we can keep returning to

slipset 2018-11-14T17:37:06.011800Z

Exactly.

slipset 2018-11-14T17:37:43.012800Z

And, even though I haven’t read the diffs carefully, it seems like most of the work has been done in the hammock, not at the keyboard.

slipset 2018-11-14T17:38:10.013400Z

Which can be annoying, since the changes seem both easy and small.

alexmiller 2018-11-14T17:38:11.013500Z

that is the work :)

slipset 2018-11-14T17:38:26.014Z

Yeah, but that work is not visible. Unfortunatly

slipset 2018-11-14T17:38:57.014700Z

I used to work at a place where we had to estimate each bug fix before it was ready for work.

slipset 2018-11-14T17:39:17.015200Z

Most of the time the estimation took weeks, but the fix took five minutes.

borkdude 2018-11-14T17:39:44.016100Z

@alexmiller there were a few things that we need some answers on spec-wise. I know you’re a busy man, but when you have the time, we’d be happy to have your feedback

alexmiller 2018-11-14T17:39:45.016200Z

well, you weren’t estimating - you were fixing :)

slipset 2018-11-14T17:40:45.017Z

I know. But the business side didn’t quite understand that.

alexmiller 2018-11-14T17:41:10.017400Z

just fyi, I am focusing right now on some big changes in the next version of spec, which is happening at https://github.com/clojure/spec-alpha2

alexmiller 2018-11-14T17:41:38.018100Z

and speculative will be a great set of tests to check things with

borkdude 2018-11-14T17:42:00.018900Z

@alexmiller great, I’ll wait some more before asking you again 🙂

slipset 2018-11-14T17:42:10.019300Z

@alexmiller you just made me very happy!

alexmiller 2018-11-14T17:42:17.019500Z

the current state there actually does contain a non-macro entry point to making specs

alexmiller 2018-11-14T17:42:50.020100Z

although it is very difficult to see without some direction

alexmiller 2018-11-14T17:43:07.020500Z

that will be coming, but have some more things to do first before I am ready to write the explainers

alexmiller 2018-11-14T17:43:48.021200Z

should be api-compatible right now (although surely I broke something here or there)

slipset 2018-11-14T17:45:06.022100Z

just give us a word if there’s anything we can do to help.

alexmiller 2018-11-14T17:45:36.022400Z

well, testing speculative with this lib would be super helpful

alexmiller 2018-11-14T17:46:19.023100Z

you should be able to change the dep (will need a git dep) and your require to the new ns

borkdude 2018-11-14T17:47:47.023400Z

would it make sense to test now? I can make a branch after dinner

borkdude 2018-11-14T17:48:16.023700Z

fwiw, the questions I was talking about: https://github.com/slipset/speculative/issues/46#issuecomment-435568645

slipset 2018-11-14T17:49:25.023900Z

https://github.com/slipset/speculative/issues/124

alexmiller 2018-11-14T17:52:10.024900Z

you can test now if you like. there will be some more changes (breaking up some stuff into multiple namespaces) but the api should at this point be stable and I expect every commit to be self-consistent and have tests passing

alexmiller 2018-11-14T17:52:29.025300Z

feel free to @ me on issues in the future too, I’ll get the notifications

alexmiller 2018-11-14T17:53:12.025600Z

looks like I missed that one somehow

slipset 2018-11-14T18:42:07.026100Z

@alexmiller wouldn’t we need a deps.edn in clojure.spec.alpha-2 to depend on it via a sha?

slipset 2018-11-14T18:42:44.026300Z

hmm, no

borkdude 2018-11-14T18:56:03.026900Z

@slipset you can do a :local/root dependency

slipset 2018-11-14T18:56:28.027200Z

oh, like just downloading the lib?

borkdude 2018-11-14T18:56:38.027400Z

yeah

borkdude 2018-11-14T18:56:49.027700Z

but I’m not sure if that overrides the spec that comes along with clojure 1.10

borkdude 2018-11-14T18:56:59.028Z

well, it’s different namespaces, so that doesn’t matter

borkdude 2018-11-14T18:57:17.028300Z

I’ll also give it a try now

slipset 2018-11-14T18:59:16.028500Z

🙂

mfikes 2018-11-14T19:24:38.029200Z

You can also use it as a git lib, FWIW

$ clj -Sdeps '{:deps {clojure/spec-alpha2 {:git/url "<https://github.com/clojure/spec-alpha2>" :sha "639767ebe1491536ec7404d8b478628ecfe9200b"}}}'
Cloning: <https://github.com/clojure/spec-alpha2>
Checking out: <https://github.com/clojure/spec-alpha2> at 639767ebe1491536ec7404d8b478628ecfe9200b
Clojure 1.10.0-beta5
user=&gt; (require 'clojure.spec-alpha2)
nil
user=&gt; (dir clojure.spec-alpha2)
&amp;
*
*coll-check-limit*
...

slipset 2018-11-14T19:28:17.029500Z

For some reason I was unable to get that working.

slipset 2018-11-14T19:28:42.029900Z

probably PEBCAK

borkdude 2018-11-14T19:28:42.030Z

@slipset can you try again and if it works, push that to the branch?

slipset 2018-11-14T19:28:51.030300Z

yeps

borkdude 2018-11-14T19:28:51.030400Z

meanwhile I’m fixing some macros

slipset 2018-11-14T19:34:05.031400Z

@borkdude pushed

borkdude 2018-11-14T19:34:33.031600Z

I’ve also pushed

slipset 2018-11-14T19:34:46.031800Z

I won 🙂

borkdude 2018-11-14T19:34:51.032Z

we both won

borkdude 2018-11-14T19:35:35.032400Z

with branch spec-alpha2:

$ clj -A:test
Cloning: <https://github.com/clojure/spec-alpha2>
Checking out: <https://github.com/clojure/spec-alpha2> at 639767ebe1491536ec7404d8b478628ecfe9200b
Clojure 1.10.0-beta5
user=&gt; (require '[clojure.spec-alpha2.test :as stest])
nil
user=&gt; (require '[speculative.core.extra])
nil
user=&gt; (doall (stest/check `=))
Execution error (IllegalArgumentException) at clojure.spec_alpha2$spec_STAR_/invokeStatic (spec_alpha2.clj:389).
Symbol must be namespace-qualified
user=&gt;

borkdude 2018-11-14T19:35:54.032800Z

@alexmiller ^

borkdude 2018-11-14T19:36:44.033200Z

is there a way to exclude the normal spec dep to ensure it never get loaded?

borkdude 2018-11-14T19:39:29.033800Z

the line number is probably off because of the in-ns at line 18. 389 + 18 = 407: https://github.com/clojure/spec-alpha2/blob/master/src/main/clojure/clojure/spec_alpha2/test.clj#L407

slipset 2018-11-14T19:47:33.034800Z

That seriously broke things 🙂

slipset 2018-11-14T19:47:39.035200Z

committing and pushing

slipset 2018-11-14T19:48:10.035400Z

604d6861e80c3a1377e78f09db6cf185a950837c is pushed

borkdude 2018-11-14T19:49:41.035600Z

thanks

borkdude 2018-11-14T19:55:02.035900Z

I think clojure itself still is requiring clojure.spec.alpha

borkdude 2018-11-14T19:55:49.036400Z

because of the macro checking. so we have to test with it

slipset 2018-11-14T19:55:54.036600Z

cool

borkdude 2018-11-14T19:56:01.037Z

I’ll revert it

slipset 2018-11-14T19:56:02.037100Z

then just revert that commit

slipset 2018-11-14T19:56:05.037300Z

🙂

borkdude 2018-11-14T20:00:46.037700Z

@alexmiller repro:

$ clj -Srepro -Sdeps '{:deps {clojure/spec-alpha2 {:git/url "<https://github.com/clojure/spec-alpha2>" :sha "639767ebe1491536ec7404d8b478628ecfe9200b"}}}'
Clojure 1.9.0
user=&gt; (require '[clojure.spec-alpha2.test :as stest])
nil
user=&gt;  (require '[clojure.spec-alpha2 :as s])
nil
user=&gt;  (defn foo [x] true)
#'user/foo
user=&gt;  (s/fdef foo :args (s/cat :x int?))
user/foo
user=&gt; (stest/check `foo)
IllegalArgumentException Symbol must be namespace-qualified  clojure.lang.Var.find (Var.java:140)
(user=&gt; (stest/check 'user/foo)
IllegalArgumentException Symbol must be namespace-qualified  clojure.lang.Var.find (Var.java:140)

borkdude 2018-11-14T20:24:16.038800Z

when I comment out stuff that uses stest/check it kind of works: $ clojure -A:test:clj-tests

Ran 27 tests containing 104 assertions.
0 failures, 0 errors.

alexmiller 2018-11-14T20:40:51.039600Z

is check not working? (wouldn’t surprise me if some gens were messed up)

alexmiller 2018-11-14T20:42:25.039900Z

oh, sorry read back farther

alexmiller 2018-11-14T20:42:38.040200Z

that’s weird, will check on it

borkdude 2018-11-14T20:43:09.040700Z

Fixed another bunch of tests. The only part not working is around check (normally we have 120 assertions now in master):

Ran 30 tests containing 116 assertions.
0 failures, 0 errors.

borkdude 2018-11-14T20:45:09.041300Z

@slipset please don’t merge this branch, it’s hackity hack 🙂

slipset 2018-11-14T20:52:05.042600Z

I think it needs to be on a separate ranch for the time being. Nobody’s using alpha-2 yet?

borkdude 2018-11-14T20:52:16.042900Z

yeah, think so

alexmiller 2018-11-14T20:52:34.043200Z

oh yeah, I would definitely not rely on it yet

borkdude 2018-11-14T20:56:12.045Z

@alexmiller about set/union: https://github.com/slipset/speculative/issues/46#issuecomment-438756807 I think in #clojure-dev you recently told @slipset that not expecting a set is “broken”, but set/union should be able to accept something not set-like. set-coercible? (something that can be turned into a set) would probably describe the args for set operations then.

alexmiller 2018-11-14T20:56:47.045600Z

I think I said not expecting a set return value is broken

borkdude 2018-11-14T20:57:00.045800Z

yes, sorry, that’s what I meant

borkdude 2018-11-14T20:57:36.046800Z

here union is called with two key-seqs: https://github.com/clojure/clojure/blob/9baebd091b1301aecaaac3b5f9c7ede5dcc58f8c/src/clj/clojure/data.clj#L118 it’s never going to return a set, although the result can be coerced to set.

alexmiller 2018-11-14T20:57:39.047100Z

I haven’t looked at it enough to say something good for inputs, and it may not be the same answer on every fn

alexmiller 2018-11-14T20:58:21.047600Z

well, I would start from the assumption that existing code that works shouldn’t violate the spec

borkdude 2018-11-14T20:59:00.048600Z

ok yes. and when clojure gets coercion of arguments to sets one day, we can rely on the result to be a set

alexmiller 2018-11-14T20:59:08.048800Z

so I’ll go back and just say - I don’t know as I have not worked on it :)

borkdude 2018-11-14T20:59:44.049400Z

ok 🙂

alexmiller 2018-11-14T21:02:04.050100Z

in the list of things that are important to me, this is really far down the list :)

borkdude 2018-11-14T21:03:41.050300Z

we’ll figure it out 😉

borkdude 2018-11-14T21:04:06.050700Z

you can always submit a PR when you strongly disagree 👍

alexmiller 2018-11-14T21:04:39.051Z

I’ll just file a jira with a patch

alexmiller 2018-11-14T21:04:53.051500Z

😉

slipset 2018-11-14T21:05:01.051900Z

As long as you’ve signed the CA ;)

borkdude 2018-11-14T21:05:09.052100Z

As long as you’ve signed our CA 😉

slipset 2018-11-14T21:05:18.052300Z

lol

alexmiller 2018-11-14T21:20:36.052600Z

I find your open source project hostile

borkdude 2018-11-14T21:21:14.052800Z

actively?

alexmiller 2018-11-14T21:21:20.053Z

quite

alexmiller 2018-11-14T21:21:36.053300Z

I will now go write a multi-page rant on Medium

borkdude 2018-11-14T21:22:01.053800Z

“Fuck speculative. There, I said it.“ 😉

alexmiller 2018-11-14T21:22:18.054Z

too soon

mfikes 2018-11-14T21:26:05.054500Z

Hah

mfikes 2018-11-14T21:26:50.055100Z

Rich devs write their code in $peculative

borkdude 2018-11-14T22:07:43.055500Z

spec-alpha2 branch is building again for all platforms: https://circleci.com/gh/slipset/speculative/tree/spec-alpha2

borkdude 2018-11-14T22:08:36.055900Z

(stest/check tests still excluded)