3 ms·
Yes, me. I develop an IDE for Clojure code which is a mix of Clojure and Kotlin. I like both, but what I like about Clojure is the interactive programming, not
by lemming 3y ago
Yes, me. I develop an IDE for Clojure code which is a mix of Clojure and Kotlin. I like both, but what I like about Clojure is the interactive programming, not the lack of types. If there were a statically typed Clojure I’d be all over it.
- klibertp 3y agoThere's no Typed Clojure, still? I seem to remember people porting Typed Racket to Clojure; a quick search gives me core.typed[1] and typedclojure[2]. There's an example[3] looking like this: (t/ann hello-world-error [t/Int :-> t/Str]) (defn hello-world-error [a] (inc a) ;#"Simplified a bit") which looks like Typed Racket, where you'd get: (: hello (Number . -> . String)) (define (hello num) (add1 num)) (both definitions are rejected at compile time; in Racket, it works in the REPL, too, not sure about Clojure) ...and Typed Racket is a really powerful type system (see refinement types[4]). So, I thought it's just a matter of time for Clojure to get to that level of power and support. It should be much easier to do this to Clojure than to Ruby, given that you have a working example of how to do it well. So I'm really surprised Clojure isn't gradually typed by now, with most of the code being annotated and type-checked at compile time. [1] https://github.com/clojure/core.typed https://github.com/clojure/core.typed [2] https://github.com/typedclojure/typedclojure https://github.com/typedclojure/typedclojure [3] https://github.com/typedclojure/typedclojure/blob/main/example-projects/minimal/src/typed_example/minimal.cljc https://github.com/typedclojure/typedclojure/blob/main/examp... [4] https://docs.racket-lang.org/ts-reference/Experimental_Features.html https://docs.racket-lang.org/ts-reference/Experimental_Featu...
- lemming 3y agoTyped Clojure is still a thing and I think Ambrose is still working on it, but I don't think anyone actually uses it in practice. A few companies tried it and then backed it out, but that was a while ago now. It may be better recently but I haven't made the time to really kick the tyres on it to see what's changed. Previous it was just a pain ergonomically.
- klibertp 3y agoHmm, that's sad. I guess the difference with Typed Racket is that the Racket devs and researchers behind it were all completely sold on the idea from day one, which resulted in a quick progress in annotating the whole of the stdlib. Without that, you'd need to annotate everything you require (import) yourself, which would be a massive pain. Another difference might be the module system of Racket, which is pretty unique. IIRC Clojure modules are just namespaces, similar to CL, right? In Racket, the module system along with the extensive support for contracts, allowed TR to be much more strict with types, while still interfacing well with untyped code. In effect, Racket as a whole is gradually typed, but within the bounds of TR modules there's a sound, fully static type system. It's a shame. I thought Clojure, as the only Lisp currently used in the industry, would benefit from the great work of Racket folks the most. After all, static typing in your pet project is much less important (or even desirable) than in a production-quality software made by a team of devs under time constraints. It's strange to see JavaScript and Python getting (widely used) gradual type systems before Clojure when the foundational work on gradual type systems was done in Lisps (Scheme and Racket).