
Clojure 1.11 planning - galfarragem
https://insideclojure.org/2019/10/06/journal/
======
xtreak29
Clojure had kept the core lean and simple and has grown through the years with
libraries for features like spec. It makes the language as a whole stable with
features developed and tested like spec being a library in alpha.

------
badsavage
Spec is very useful, but please implement it without macros. Metosin did a
great job to make it more usable, but we still struggle because specs could
only exist in Namespaces. We want to use spec as EDN with pure functions. (+
recursive specs would be awesome)

~~~
puredanger
Spec 2 can be used without touching any macros if desired and has a lot more
programmatic options.

~~~
badsavage
Awesome!

------
roenxi
I enjoy Clojure and spec is very interesting; but it remains uncertain if I
have any problems that spec will solve. I'm not really that interested in the
generative testing aspect since I write mostly amateur code.

So I can't figure out if it is more like a debugger for targeted location of
difficult bugs or more like compiler error messages where it becomes a
pervasive part of the workflow.

There is obviously something to this spec if it warrants a v2. It just isn't
obvious whether it solves my problems, library maintainer problems or
professional problems. It is very different to the immutable-everywhere design
where a Clojure beginner is forced in to understanding it to even try trivial
experiments.

~~~
dancek
Spec is great for validation. For example, we have a HTTP API built using
[https://github.com/metosin/reitit](https://github.com/metosin/reitit) where
we have specs for each endpoint. We have a coercion middleware that checks
each request (and optionally response) conforms to a spec (and coerces things
like integer ids from path to the correct type). And there's a swagger handler
that automatically generates a full documentation of the API just from the
route tree and specs, including samples of input and output for all routes.

Similarly you can do HTML form validation, etc.

We even use honeysql with nice helper functions that ensure that data-changing
SQL queries are of the expected form. Say, you want to update just one row,
you have a helper function that checks the honeysql data has a where clause
with a unique column and only then runs the query. Someone should maybe blog
about that sometime.

What I've found, though, is that trying to use spec like type checking is
usually not a great idea. I expect better from static analysis / compile-time
checking, with clj-kondo being the most promising tool atm.

~~~
Scarbutt
I remember spec being pitch for something you only use at dev time and turn
off in production because it makes your runtime very very slow, what has
change? Seems users are using it for everything now.

~~~
seancorfield
Spec has numerous uses. We use it heavily in production for data
validation/conformance: [https://corfield.org/blog/2019/09/13/using-
spec/](https://corfield.org/blog/2019/09/13/using-spec/)

------
_bxg1
> Spec 2 has been kind of stalled out as Rich is thinking through some of the
> work we were doing on how to rework function specs and the use case of
> automating form/map versions of the specs.

It's fascinating to watch a major enterprise language with a Steve Jobs figure
at the top, who maintains a firm grip on the wheel, keeping it on track with
his clear vision even as its community grows in scale, to the point where he
alone would be a bottleneck in its design process.

I mean it's clearly working out - as it worked out for Jobs - it's just highly
unusual.

------
thelazydogsback
I'd love to see more focus on non-JVM impls other than JS -- .Net Core 3.x
specifically. (ClojureCLR is pretty much dead, right?)

~~~
rcarmo
It gets regular commits, but I've found it impossible to use practically,
somewhat to my regret (I have plenty of use for a LISP that can do .NET
interop).

~~~
robto
You might want to check out Arcadia[0], a Clojure library for Unity game
development. It's all done with ClojureCLR and it's pretty cool. Not saying
you want to do game development, but they've definitely got a working product
and you can see how they've set up their project.

They just got a round of funding this year, and they've got several good talks
posted on their homepage about the quirks of working on .NET.

[0][https://github.com/arcadia-unity/Arcadia](https://github.com/arcadia-
unity/Arcadia)

~~~
rcarmo
I did, but it was a bit stale a year or so ago (as in it wouldn't even work
with the Unity build at the time). Which is too bad, since one of my kids is
doing Unity micro-games and I would like to have alternatives...

~~~
bananaoomarang
Development has picked up again AFAIK, saw one of the developers give a short
demo/talk on it recently and it seems neat.

Godot is a decent OSS alternative to Unity, but no Clojure/Lisp so far as I
know :(

~~~
yogthos
Yup, Ramsey gave a talk at Clojure/north [1] about Arcadia. I got a chance to
briefly chat with him, and it looks like they actually managed to raise
funding to develop it further.

And somebody made Arcadia bindings for Godot [2], but the project isn't
actively maintained. Would be great if somebody picked it up again.

[1]
[https://www.youtube.com/watch?v=LbS45w_aSCU](https://www.youtube.com/watch?v=LbS45w_aSCU)
[2] [https://github.com/arcadia-
unity/ArcadiaGodot](https://github.com/arcadia-unity/ArcadiaGodot)

------
logistark
Cool, cool. When is full compatibility with Java 8 be available? I mean Java 8
SAMs, Java 8's Stream, Optional and CompletableFuture...

~~~
dancek
What parts of compatibility are missing? The interop works just fine, as with
all other Java.

    
    
      ; example: Stream.of(1,1,2,3,5).map(x -> 2*x).collect(Collectors.toList())
      user=> (.. (java.util.stream.Stream/of (to-array [1 1 2 3 5]))
                 (map (reify java.util.function.Function 
                        (apply [this x] (* 2 x)))) 
                 (collect (java.util.stream.Collectors/toList)))
      [2 2 4 6 10]
    

Of course it's not practical to convert lists and functions to their Java
counterparts like that, but if you need to work with Java objects it's
possible.

~~~
agumonkey
so no Java Function to clojure Function automating mapping ? do people use
macros to make it nicer ?

~~~
Uhuhreally
you'd use Clojure not Java for an example like the above

~~~
Scarbutt
I think the context is when doing interop.

~~~
Uhuhreally
yes but I got the feeling the grandparent was confused so I tried to clarify
that the only reason for the verbosity is interop - the Clojure code is much
more concise than the Java - the interop code is like listening to a speech
being translated between English and Spanish

