Hacker News new | ask | show | jobs
by raspasov 331 days ago
> first-class maps, vectors, arrays, sets, counters, and more

That's my mistake; this line was intended to be a sub-bullet point of the previous line regarding CRDTs.

> the language already allows you to have protocols everywhere

The core data structures, for example, are not based on protocols; they are implemented in pure Java. One reason is that the 1.0 version of the language lacked protocols. All that being said, it remains an open question what the full implications of the protocol-first idea are.

> You can write your code using transducers or opt in for laziness in Clojure now. So it's a matter of choice of tools, rather than a feature of the language.

You 100% can. Unfortunately, many people don't. The first thing people learn is (map inc [1 2 3]), which produces a lazy sequence. Clojure would never change this behavior, as the authors value backward compatibility almost above everything else, and rightly so. A transducer-first approach would be a world where (map inc [1 2 3]) produces the vector [2 3 4] by default, for example.

This was mentioned by Rich Hickey himself in his "A History of Clojure" paper:

https://clojure.org/about/history https://dl.acm.org/doi/pdf/10.1145/3386321

(from paper) > "Clojure is an exercise in tool building and nothing more. I do wish I had thought of some things in a different order, especially transducers. I also wish I had thought of protocols sooner, so that more of Clojure’s abstractions could have been built atop them rather than Java interfaces."