Hacker News new | ask | show | jobs
by riboflava 3570 days ago
I'm a fan of the out of the box immutable data structures and like the sugar, though you can get both in Lisp if you want. (Presumably Racket as well.) Lisp has everything, and more, though sometimes you have to work for it. I do enjoy Clojure's interop with the JVM, but that along with the community producing interesting things (this includes ClojureScript) are the primary reasons I care about Clojure at all. On the nice-to-work-with side of things I really enjoy that it was designed by one person rather than a standards committee from decades ago, it feels fresh working with it, but if you stranded me on an island and gave me one language to have for the rest of time I'd pick Lisp for its power.
2 comments

> you can get both in Lisp if you want

The whole point of benefiting from immutable data structures is their ubiquity. If they're something you reach for only when you personally decide you need them, they're unlikely to work well with 3rd-party code; you will have to do a lot more digging to understand how the code you're writing will behave in a concurrent context vs having it be obvious. Making it opt-in is almost making it pointless, unless you never use 3rd-party code.

Is it possible to make truly persistent data structures in Lisp, rather than just persistent by convention? Here are some benefits that you can only get if the language implementation knows your data structures are immutable:

(0) The compiler can automatically perform optimizations like fusing small nodes and hash consing.

(1) The garbage collector can take advantage of the fact that traversing (the immutable portion of) the heap sequentially produces a topological sorting of the object graph.