Live data from Hacker News

My thoughts after using Clojure for about a month

acdw.net

151–160 of 204 posts

Re: My thoughts after using Clojure for about a month

#151
post #6

With respect, this topic in particular has been beaten to death. I too liked Clojure when I tried it some years ago (agreed on the composition and data structures; both are _great_). But the real value-add is in the runtime, not the syntax. Java has a solid runtime but it's not yet as good as Erlang's, maybe even not up to the standards of Golang -- I am talking concurrency / parallelism here (for memory management I…

Not even to optimize for, but to write correct programs you really need to understand the runtime which is usually broader than the syntax. All Clojure (lisps) do is remove the stupidity of syntax. Even if syntax is the minor thing, why wear a stupid, uncomfortable shirt while running when you could wear one so comfortable you scarcely feel it?

Well I agree, that's why I use Elixir and not its underlying Erlang.

And I agree that most LISPs remove the stupidity of syntax. Very true.

Re: My thoughts after using Clojure for about a month

#152
post #118

> "I do wish there were an easier way to move in the ]}]})))}-ness of block ends though." If he means navigating the AST, there is Parinfer: https://shaunlebron.github.io/parinfer/ Paredit / Parinfer ruined other languages for me. It lets you navigate up/down/in/out of the Clojure AST with keyboard commands and mutate those expressions, e.g. "Split" will split open the current data structure you're in: `(a| b)` =Spli…

Indeed. The incredibly clumsy way we choose to edit source code has baffled me since I was first acquainted with parinfer. Having to keep the source in the shape of a valid AST almost entirely manually is really annoying.

This is borderline silly, though. It is clumsy to start. But so is walking. As is running. Have you seen people start out on bicycles? What about writing? Talking?

That is to say, all things start out clumsy. And people that are good at it, no longer feel that it is clumsy. Which is why a lot of people that have been working with this for any time just don't think of this much.

Re: My thoughts after using Clojure for about a month

#153

I spent a week with Clojure and coming from other functional languages my problem was not Clojure, it was dynamic typing. I got strange bugs in the standard library because I accidentally sent in nested incompatible instances of objects and it was really hard to figure out what was wrong in a quick way. With typesafe languages you are stopped at compile time.

Clojure was explicitly designed to be dynamic. It’s a feature, not a bug. https://clojure.org/about/dynamic Until you get better at not making mistakes that the training wheels of a static type system “protect” you from, lean into the REPL as a means to build up small correct expressions into larger ones.

"Until you get better" is such an arrogant take.

It's not just about skill. It's about maintainability, ease of refactor, and modeling invariants in your code in a way that they can be checked by the machine (the compiler) without every single developer having to maintain them in their head.

Clojure even knows this is an issue and many people use `spec` to sort of retrofit static typing.

Dynamic typing was, is and always will be a mistake. There is nothing you can do with dynamic typing that you cannot do with a sufficiently powerful static type system - and it doesn't have to be something absurd like Haskell's. You basically just need structural typing and type inference and some type-level programming constructs.

The worst part about Clojure is the community. Rich Hickey has cult-like status and the only thing clojurians can do is parrot his inane commentary.

Re: My thoughts after using Clojure for about a month

#154
post #118

> "I do wish there were an easier way to move in the ]}]})))}-ness of block ends though." If he means navigating the AST, there is Parinfer: https://shaunlebron.github.io/parinfer/ Paredit / Parinfer ruined other languages for me. It lets you navigate up/down/in/out of the Clojure AST with keyboard commands and mutate those expressions, e.g. "Split" will split open the current data structure you're in: `(a| b)` =Spli…

I type out nowhere near enough code for this to matter, but it's pretty cool nonetheless!

Re: My thoughts after using Clojure for about a month

#155
post #38

Once you learn Clojure's syntax and semantics, you're no longer bound to the JVM. There's ClojureScript (JS), ClojureCLR, ClojureDart, jank (C++), Basilisp (Python), babashka (SCI), and many others. This means that, if you don't know Java or don't like the JVM, you can likely use Clojure wherever you already feel most comfortable. For the most part, any Clojure code which doesn't use host interop will work on all dia…

> babashka (SCI)

Correct me if I'm wrong, but isn't babashka's "host"... um.. "native", for lack of a better word? It's compiled with Graal VM native, no?

Yes, there is SCI (Small Clojure Interpreter) in the middle, but that's beside the point, no?

https://github.com/babashka/babashka

https://github.com/babashka/sci

Re: My thoughts after using Clojure for about a month

#156
post #118

> "I do wish there were an easier way to move in the ]}]})))}-ness of block ends though." If he means navigating the AST, there is Parinfer: https://shaunlebron.github.io/parinfer/ Paredit / Parinfer ruined other languages for me. It lets you navigate up/down/in/out of the Clojure AST with keyboard commands and mutate those expressions, e.g. "Split" will split open the current data structure you're in: `(a| b)` =Spli…

Indeed. The incredibly clumsy way we choose to edit source code has baffled me since I was first acquainted with parinfer. Having to keep the source in the shape of a valid AST almost entirely manually is really annoying.

Syntax-directed editors were all the rage in the late 70s early 80s...and a huge failure, because they were a lot more annoying than any text editor has a chance of ever being.

It's one of those things that, like visual programming, is absolutely and obviously The Right Thing™ until you try to implement it and use it.

That said, we have made progress in both areas, and maybe we will figure them out in the future.

Re: My thoughts after using Clojure for about a month

#157
post #38

Once you learn Clojure's syntax and semantics, you're no longer bound to the JVM. There's ClojureScript (JS), ClojureCLR, ClojureDart, jank (C++), Basilisp (Python), babashka (SCI), and many others. This means that, if you don't know Java or don't like the JVM, you can likely use Clojure wherever you already feel most comfortable. For the most part, any Clojure code which doesn't use host interop will work on all dia…

for JS there is also Squint which is a light-weight ClojureScript dialect without the Google Closure Compiler

indeed, light-weight means you just add a and you're off to the races.

There's also nbb if you're targeting node https://github.com/babashka/nbb

Re: My thoughts after using Clojure for about a month

#158

Earlier quoted context omitted.

> you have no clue of my stance on AI and are extrapolating a bit too much apologies, but maybe next time try to elaborate more on sweeping statements like "syntax doesn't matter", because in current context my assumption for why you would say that is not all that outrageous. > Syntax does not matter simply because it's an extremely leaky abstraction of the runtime below, is my point. that would be the reason why syn…

> that would be the reason why syntax does matter, wouldn't it? nobody wants leaky abstractions! Well I thought we were describing our current reality, not our _desired_ one? Yes nobody wants leaky abstractions and yes they are everywhere. Syntax matters insofar as to discourage bad habits, is what I'd refine from my previous statements. Most programmers go for the default so defaults and syntax that steers you the r…

> That being said, has Akka started making full use of JVM's new green threads? Has Java itself started introducing immutability and STM / share-nothing as first-class citizens? If not, then by the "programmers reach for the defaults first" rule above I'd think Java is not yet ready.

> OK Clojure has these amazing libraries, kudos. Has anybody rolled up their sleeves and said "Alright, BEAM VM's reign is over, I am making the same or better runtime as them in Java / Clojure!"?

will akka use green threads? i'm sure it will when the developers behind it deem them useful.

will jvm add immutability, stm and share-nothing primitives that (i assume you allege) are missing? sure, i guess, when it becomes frequent enough ask.

you make it seem as if the world of software development is in some constant battle for supremacy, but it just isn't.

there is no "BEAM VM's reign". and if there was - it's unlikely that anybody would care to topple it. people just want to get their job done and they use whatever tools are available, familiar and convenient for them.

> I just don't want to deal with the endless pit of determinism bugs that global mutability nets us

and a lot of people agree with you. and there's a lot of tools that address that. and i can assure you, when working with clojure, even on the blasphemous mutable jvm runtime, that class of bugs is non-existent.

Re: My thoughts after using Clojure for about a month

#159
post #96

Earlier quoted context omitted.

They are a pain if they get unbalanced if you aren’t using paredit. Like if I vi delete the last line of a function out of habit it’s a pain to get them back in the right order. It’s easier if everything is parens, just hit paren til the errors are gone.

Ah I see. That makes sense. That’s making me really thankful to be a paredit user.

Learning paredit is on my list of things to do.

I've been loving Clojure for hobby projects lately but my editing setup sucks for Clojure. The vi commands I'm used to using are bad in Clojure (eg copying by line almost always means unbalanced parens), and the autocomplete LLMs are very inconsistent about closing syntax correctly.

It seems super cool, I just haven't done it enough for my brain to reach for paredit keybinds instead of vim chords.

Re: My thoughts after using Clojure for about a month

#160

Earlier quoted context omitted.

The JVM is perfectly capable of Golang-style green threads now. As for Erlang, the creator of Clojure have commented in the past on why he dislikes the Actor model, and I think it is a fair criticism. Sometimes I see people praising Erlang VM as some panacea in which all the VMs should strive to be like. This is overly simplistic in my opinion, and ignores the huge trade-offs that the Erlang VM has.

You might be speed-running to a conclusion and squinting too hard if you use the word "panacea". Similar to the weird childish name-calling people do in Rust threads (somebody met one brainless zealot and now of course they'll judge a community of hundreds of thousands of devs by that one loony). I used Java, Golang, Rust, Elixir (so Erlang). My opinion is informed. STM / share-nothing-actors lend themselves amazingl…

I have used Clojure(JVM), Elixir(so Erlang) and a bit of Golang professionally too. So my opinion "is informed" too for that matter, but this kind of appeal to authority adds nothing to the discussion.

> I am not denying that the JVM might have almost caught up in the meantime. More than a decade ago it did not.

This presupposes that the JVM had something to catch up in the meantime. Again, this lacks nuance and brings nothing to the table. The JVM makes different trade-offs than the Erlang/Golang VM does, and has different strengths and weaknesses. Both of your comments completely ignores that.

> It's just that in my work I have found having to avoid them still worth it compared to the alternatives (global mutability and more primitive parallelism which was the case for the JVM for decades).

Clojure runs on the JVM and avoids mutability pretty well. It is amazing for writing concurrent software, and has been for many years(i.e more than a decade ago).

> Similar to the weird childish name-calling people do in Rust threads

I've seen people do similar things to the JVM.

Post reply on HN