Live data from Hacker News

Clojure 1.11 planning

insideclojure.org

61–70 of 72 posts

Re: Clojure 1.11 planning

#61
post #5

Earlier quoted context omitted.

Spec is great for validation. For example, we have a HTTP API built using 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…

I have a somewhat off-topic question I've been wondering about... How do you pronounce "reitit"? I've been considering giving a talk on it at my local clojure group, so I should probably learn how to actually say the word!

It's a Finnish word. Google Translate's text-to-speech is pretty decent - click the speaker icon on the left: https://translate.google.com/#view=home&op=translate&sl=fi&t...

Re: Clojure 1.11 planning

#62
post #5

Earlier quoted context omitted.

Spec is great for validation. For example, we have a HTTP API built using 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…

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.

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

Re: Clojure 1.11 planning

#63
post #61

Earlier quoted context omitted.

I have a somewhat off-topic question I've been wondering about... How do you pronounce "reitit"? I've been considering giving a talk on it at my local clojure group, so I should probably learn how to actually say the word!

It's a Finnish word. Google Translate's text-to-speech is pretty decent - click the speaker icon on the left: https://translate.google.com/#view=home&op=translate&sl=fi&t...

Thank you!

Re: Clojure 1.11 planning

#64

Earlier quoted context omitted.

I have a somewhat off-topic question I've been wondering about... How do you pronounce "reitit"? I've been considering giving a talk on it at my local clojure group, so I should probably learn how to actually say the word!

In my brain I usually say re-it-it, but sometimes I think "rye-tit" which makes me laugh and definitely seems wrong.

Raitit (rye-tit) is a Finnish word too: the plural of "a lone village road splitting the village in half".

Would make a nice library name. Wonder if Metosin takes requests...

Re: Clojure 1.11 planning

#65
post #16

Earlier quoted context omitted.

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…

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

Not out of the box, probably because java.util.function.Function seems like an afterthought in a strictly object-oriented language while Clojure has first class functions. In practice you don't interop with Java very much, let alone functional Java (as Clojure itself is a much better fit). But if it was useful, it'd be easy to write helpers for converting functions back and forth.

Re: Clojure 1.11 planning

#66

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

Big pain point, Java 8 was release in 2014, and the java.util.Function interfaces have become very common in practice since then. Clojure is really dying...

Oof, every single Clojure related HN post, there's always at least one person claiming that Clojure is dying. Clojure is not dying! Look around, Clojure today has more conferences, meetups, podcasts, jobs, and books. More than any of non-mainstream languages. More than Haskell, Elixir, OCaml, Elm, Rust.

I'm sorry for snapping at you. It just makes me sad to have to fight unwarranted skepticism all the time. People throw opinions out of the blue, sometimes without even considering a heartfelt attempt to try things out first.

Evangelizing for Clojure has become a moral issue. Just like arguing with gun-control, climate change opponents, and anti-vaxxers. No matter what arguments you bring to the discussion, those who don't want to listen - just wouldn't.

You say: "Clojure is very pragmatic",

They'd be: "I don't want to learn Emacs".

You say: "But you can use VSCode, Atom, Eclipse, Vim, IntelliJ to write Clojure",

They: "Too many parentheses..."

You say: "Other languages have more, and a bunch of other things like semicolons, commas, curly braces, and operator precedence rules... "

They: "But it's not statically typed"

You say: "It has Spec. Spec can do things, most type systems cannot"

They: "But I don't like JVM..."

You say: "JVM is a very robust, solid piece of tech..."

They: "Clojure is dying..."

---

Honestly, I don't understand this tribalism. Like people really don't want it to succeed. It isn't some zero-sum game - the success of one language ecosystem does not mean there's less pie for others. There are many things in other languages - Rust, Elixir, Javascript, etc. directly inspired by how they first were done in Clojure. Just think about it: Cognitect has a team of fewer than fifty developers, and the Clojure community has no more active members than engineers working for Google, yet there's a constant pace of innovation for the entire CS community. Maybe the language has something to do with that, after all?

Re: Clojure 1.11 planning

#67
post #60
post #3

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 someth…

I see it mainly as an answer to static types. Clojure (like most Lisps) places emphasis on dynamic types, for some valid reasons ( https://lispcast.com/clojure-and-types/ ). But there are certain undeniable benefits of static typing that you miss out on: documentation, and IDE hints. Spec, the way I see it, is a way to reclaim some of those benefits without giving up the dynamic paradigm. It also has some advantages…

But there are certain undeniable benefits of static typing that you miss out on: documentation, and IDE hints.

And performance.

Re: Clojure 1.11 planning

#68
post #41

Earlier quoted context omitted.

Yes, the special forms. https://clojure.org/reference/special_forms Clojure follows the Lisp convention of providing platform specific behaviour via the reader. https://clojure.org/guides/reader_conditionals

Not sure I follow -- there are certainly many primitives that must be defined by the host to bootstrap that are not special forms -- starting with list, cons/conj...

I doubt there’s a guide anywhere: it’s far from a trivial undertaking. If you want to look at the Java code that builds all the primitives, see the Clojure/Lang folder:

https://github.com/clojure/clojure/tree/master/src/jvm/cloju...

Part of what makes it Clojure instead of just a Java-based lisp are the persistent data structures that allow for efficient immutability, and the seq interface for working with collections smoothly. There’s a big (scary, to my eyes) set of classes that underlies all of the convenience. Thankfully it’s very stable so I don’t have to think about it.

Re: Clojure 1.11 planning

#69

Earlier quoted context omitted.

I have a somewhat off-topic question I've been wondering about... How do you pronounce "reitit"? I've been considering giving a talk on it at my local clojure group, so I should probably learn how to actually say the word!

In my brain I usually say re-it-it, but sometimes I think "rye-tit" which makes me laugh and definitely seems wrong.

It's more like "ray-tit". A colleague at Metosin came up with a good alternative: "rate it!" Used in sentence like "I reitit 5 out of 5!"

Re: Clojure 1.11 planning

#70
post #16

Earlier quoted context omitted.

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…

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

functions. Macros are a super weapon and their use is reserved for very special cases. One reason is macros can't be composed as functions and also readability goes out the windows.
Post reply on HN