speculative 2018-11-14

Alex Miller (Clojure team) 2018-11-14T17:10:07.001Z

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

Alex Miller (Clojure team) 2018-11-14T17:10:42.001600Z

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

Alex Miller (Clojure team) 2018-11-14T17:11:29.002100Z

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

yes, thanks

Alex Miller (Clojure team) 2018-11-14T17:16:03.003200Z

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

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

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

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

Alex Miller (Clojure team) 2018-11-14T17:34:29.007300Z

I think you should run it with 1.9 and compare

Alex Miller (Clojure team) 2018-11-14T17:34:39.007700Z

the improvement is vast imo

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

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

the gist has 1.10 and 1.9 now

But seriously. The improvements are huge!

Alex Miller (Clojure team) 2018-11-14T17:35:59.010Z

there are known things to work on

Alex Miller (Clojure team) 2018-11-14T17:36:20.010500Z

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

Alex Miller (Clojure team) 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

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.

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

Alex Miller (Clojure team) 2018-11-14T17:38:11.013500Z

that is the work :)

Yeah, but that work is not visible. Unfortunatly

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

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

@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

Alex Miller (Clojure team) 2018-11-14T17:39:45.016200Z

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

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

Alex Miller (Clojure team) 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

Alex Miller (Clojure team) 2018-11-14T17:41:38.018100Z

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

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

@alexmiller you just made me very happy!

Alex Miller (Clojure team) 2018-11-14T17:42:17.019500Z

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

Alex Miller (Clojure team) 2018-11-14T17:42:50.020100Z

although it is very difficult to see without some direction

Alex Miller (Clojure team) 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

Alex Miller (Clojure team) 2018-11-14T17:43:48.021200Z

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

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

Alex Miller (Clojure team) 2018-11-14T17:45:36.022400Z

well, testing speculative with this lib would be super helpful

Alex Miller (Clojure team) 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

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

Alex Miller (Clojure team) 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

Alex Miller (Clojure team) 2018-11-14T17:52:29.025300Z

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

Alex Miller (Clojure team) 2018-11-14T17:53:12.025600Z

looks like I missed that one somehow

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

@slipset you can do a :local/root dependency

oh, like just downloading the lib?

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

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

I’ll also give it a try now

You can also use it as a git lib, FWIW

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

For some reason I was unable to get that working.

probably PEBCAK

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

meanwhile I’m fixing some macros

I’ve also pushed

we both won

with branch spec-alpha2:

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

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

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

That seriously broke things 🙂

committing and pushing

604d6861e80c3a1377e78f09db6cf185a950837c is pushed

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

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

I’ll revert it

then just revert that commit

@alexmiller repro:

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

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.

Alex Miller (Clojure team) 2018-11-14T20:40:51.039600Z

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

Alex Miller (Clojure team) 2018-11-14T20:42:25.039900Z

oh, sorry read back farther

Alex Miller (Clojure team) 2018-11-14T20:42:38.040200Z

that’s weird, will check on it

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.

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

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

yeah, think so

Alex Miller (Clojure team) 2018-11-14T20:52:34.043200Z

oh yeah, I would definitely not rely on it yet

@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.

Alex Miller (Clojure team) 2018-11-14T20:56:47.045600Z

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

yes, sorry, that’s what I meant

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.

Alex Miller (Clojure team) 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

Alex Miller (Clojure team) 2018-11-14T20:58:21.047600Z

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

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

Alex Miller (Clojure team) 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 :)

Alex Miller (Clojure team) 2018-11-14T21:02:04.050100Z

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

we’ll figure it out 😉

you can always submit a PR when you strongly disagree 👍

Alex Miller (Clojure team) 2018-11-14T21:04:39.051Z

I’ll just file a jira with a patch

Alex Miller (Clojure team) 2018-11-14T21:04:53.051500Z

😉

As long as you’ve signed the CA ;)

As long as you’ve signed our CA 😉

Alex Miller (Clojure team) 2018-11-14T21:20:36.052600Z

I find your open source project hostile

Alex Miller (Clojure team) 2018-11-14T21:21:20.053Z

quite

Alex Miller (Clojure team) 2018-11-14T21:21:36.053300Z

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

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

Alex Miller (Clojure team) 2018-11-14T21:22:18.054Z

too soon

Rich devs write their code in $peculative

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

(stest/check tests still excluded)