This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2024-05-27
Channels
- # announcements (8)
- # babashka (11)
- # beginners (34)
- # clerk (11)
- # clj-http (2)
- # clojure (5)
- # clojure-europe (9)
- # clojure-gamedev (1)
- # clojure-nl (1)
- # clojure-norway (17)
- # clojure-poland (1)
- # clojure-sweden (5)
- # clojure-uk (9)
- # clojurescript (17)
- # core-typed (12)
- # cursive (4)
- # datahike (4)
- # datalevin (2)
- # datomic (7)
- # emacs (8)
- # events (8)
- # graphql (5)
- # gratitude (1)
- # hyperfiddle (19)
- # jobs-discuss (4)
- # leiningen (4)
- # lsp (21)
- # meander (2)
- # off-topic (9)
- # play-clj (1)
- # polylith (10)
- # releases (1)
- # sci (18)
- # vim (10)
Today I had a call with one company's HR and I understood that as Clojure has macros it allows to not feel screwed by language authors when you can't upgrade. I had one job where I worked in Java 8 and my next job ended up being Java 6. After that job later I found Clojure and even though a person doesn't need to add macros it's actually a reassuring thing as you can author your own foreach loop (like in various examples). This means that macros provide a safety net so that you can't get screwed with forwards-compatibility when language authors decide to add Streams (Java) and so on. Clojure simply doesn't need these large features because they can ship most of them as regular libraries.
> Clojure simply doesn't need these large features because they can ship most of them as regular libraries. ..plus Clojure itself can be though of as being a really nice small and zero-dependencies "library" itself as well. Single 3.9MB jar 🙂 https://mvnrepository.com/artifact/org.clojure/clojure/1.11.3 I remember one clojure "language feature" which was added not too long ago in the past. It was the ability to destruct the "& rest" arguments of function as a map, even if the "rest part" was a vector. Basically this became possible:
(defn foo [a b & {:keys [c d]}]
{:a a, :b b, :c c, :d d})
(foo "a" "b" :c "c" :d "d")
;; => {:a "a", :b "b", :c "c", :d "d"}
What was incredible was that in order to try this new feature, I simply had to bump a clojure version number in deps.edn and that was it. No need to install new JVM, no need to wait for IDE vendors to catch up, no nothing.
One other beautiful example I like: with-open
macro. Where adding something like this took quite a lot of time and effort in other languages (try with resource syntax added to java 1.7 + tools had to adapt to new syntax), in clojure adding something like this is trivial. Also you can easily copy that short and simple macro and make your own extended version of it.@U9W4ZULJV I think that I was trying to refer to this change in clojure 1.11: https://github.com/clojure/clojure/blob/master/changes.md#21-keyword-argument-functions-take-a-trailing-map But perhaps I messed up the description of it, not sure 🙂
plus Clojure itself can be though of as being a really nice small and zero-dependencies "library" itselfI'd not make this argument myself because Java is kind-of a library for JVM too. Except you'd have to generate .class
files yourself if you'd want to interface with JVM.
So Java would be a way to generate .class
files.
In this regard Java is also a library, an addon for JVM.
> I simply had to bump a clojure version number in deps.edn and that was it
This is how you'd migrate from Java 6 to Java 7 and others. Just bump the version.
I don't think there is a conceptual difference here. Except the tooling.
What I tried to say was that since the programmer is allowed to go into the compiler part of this library it avoids a lot of issues that include waiting for language authors to "save the day".
And in Clojure's case the community can design a library and improve on language author's ideas because the core is not closed for modification.