News for hackers. Stuff that matters.
Re:Clojure 1.9 is now available by escherize on Friday December 08, 2017 @03:23PM (#15881713)
Yes! With this release clojure.spec is ready to go (tm).

It adds a ton to Clojure(script), including better error messages (yes!), data-structure shape declarations, generation of data, writing quickcheck (generative) tests for a function by just describing the args and return values of functions, and more.

Re:Clojure 1.9 is now available by karma_fountain on Friday December 08, 2017 @03:27PM (#15881744)
Yes, but I'm confused. The website still says specs still in alpha so whats the deal? Is the spec api now stable?
Re:Clojure 1.9 is now available by tensor on Friday December 08, 2017 @03:29PM (#15881763)
Spec is still alpha as far as I'm aware. They decided to break spec off into it's own library because it was holding up the release of 1.9.
Re:Clojure 1.9 is now available by puredanger on Friday December 08, 2017 @03:35PM (#15881808)
The API is still subject to change (alpha) but those changes are not expected to be dramatic at this point.
Re:Clojure 1.9 is now available by roenxi on Friday December 08, 2017 @04:21PM (#15882153)
I'm looking forward to hearing a long-form rational of the :args :ret :fn function instrumenting decisions, and seeing if the devs see it as an easy choice or up for debate.

It feels really uncomfortable declaring a full spec for a function & instrumenting it, then getting feedback if the args don't conform to spec but Clojure being A-OK if the return value doesn't.

I understand well that in theory the functioning of a function can be fully checked in a proactive test framework, but the process for testing return values is way clunkier and less fun than testing argument values. It just seems weird that the function has a spec, the function doesn't conform and Clojure doesn't seem to be bothered.

I can see it will only be a matter of days until I have Orchestra installed for all my projects.

Re:Clojure 1.9 is now available by int_19h on Friday December 08, 2017 @09:49PM (#15883980)
I'm not familiar with Spec, but what you're describing sounds like enforcing preconditions but not postconditions by default, which is what most DbC frameworks (or languages with intrinsic support) normally do. The idea being that most of the time, you're running library code, and you want to validate what you're passing in, but you trust it to do the right thing for any input that is valid.
Re:Clojure 1.9 is now available by coinme on Saturday December 09, 2017 @02:43AM (#15884756)
That’s fine, and makes sense, but without hacks, it is not possible to turn on ret checking in your tests that are not generative tests - so no post condition checks in the rest of your test suite.

I believe this is a missed opportunity to find bugs.

Re:Clojure 1.9 is now available by bpicolo on Friday December 08, 2017 @04:51PM (#15882379)
Why are all the relevant changes for a point release alpha? Why do you reckon this isn’t 1.9-alpha?
Re:Clojure 1.9 is now available by puredanger on Friday December 08, 2017 @05:40PM (#15882734)
There are also many changes in the language itself (see https://github.com/clojure/clojure/blob/master/changes.md), none of which are alpha.

The things that are really the new big drivers are pieces that are not inside the language (other than a few spec integration points). Those things are significant pieces of work that are imminently usable now, but not quite final yet. In the interest of getting this work into more hands, we made a new release of the language with those parts marked as alpha.

The modularized spec allows us to continue releasing new versions (and for you to use them) with Clojure 1.9.0. Eventually spec will leave alpha and we will consider that a finalized part of the language. Similarly, tools.deps is still evolving as we work on it but the tools should remain fairly stable.

Re:Clojure 1.9 is now available by WalterGR on Friday December 08, 2017 @06:50PM (#15883153)
better error messages (yes!)

What are some good examples of this?

Re:Clojure 1.9 is now available by puredanger on Friday December 08, 2017 @07:20PM (#15883321)
At the moment, most of the things that are spec'ed in the box are the gnarly macro "languages" like destructuring, defn, ns, etc. These spec'ed macros do catch a far more complete set of error messages than the macro did with custom error handling. However, those error messages are in many case more challenging to read than before. This is an area of ongoing research - the reasons for the complexity are varied. In general, specs for core functions are much simpler and provide much better errors, but we have not focused on adding those yet. This is why some of this stuff is still alpha!
Re:Clojure 1.9 is now available by misterbowfinger on Saturday December 09, 2017 @12:08AM (#15884413)
Do you have an idea of how far along clojure.spec is for a stable, non-alpha/beta release? clojure.spec is by far the most interesting and compelling reason for me to check out Clojure.

I would also love for it to apply to ClojureScript as well, although I understand that's a separate project.

Re:Clojure 1.9 is now available by puredanger on Saturday December 09, 2017 @08:26AM (#15885694)
You should try it now - the API has been out and stable for over a year. While it may change slightly, there is no reason not to use it now. https://clojure.org/guides/spec

The ClojureScript version of spec is largely API-compatible as well so the same specs should work in both.

Re:Clojure 1.9 is now available by simongray on Saturday December 09, 2017 @05:32AM (#15885177)
Spec is also available for ClojueScript: http://cljs.github.io/api/cljs.spec.alpha/