4 ms·
I really like and use Clojure professionally, but I have become wary of the extraordinary time I spend dealing with runtime issues because of the dynamic typing
by hellofunk 8y ago
I really like and use Clojure professionally, but I have become wary of the extraordinary time I spend dealing with runtime issues because of the dynamic typing. I hope the future of core.typed is bright. I know it is being very seriously worked on. It can't come soon enough for me. Nowadays, I prefer to write in any statically typed language even if it is more line counts, just for my own sanity.
- r00k 8y agoAre you using core.spec in your codebase? Did that help at all?
- hellofunk 8y agoNo, core.spec does not address the main issues with dynamic typing. It offers some neat stuff, but it is not a replacement for static typing.
- cutler 8y agoDude, Clojure is a dynamically typed language and always will be. If you don't like it use something else.
- hellofunk 8y ago> Clojure is a dynamically typed language and always will be I don't entirely agree with the "always will be," as Clojure is a very creative language that inspires a wide variety of experimentation, and core.typed is currently being actively worked on (as a PhD dissertation no less by the original author of core.typed), so there is ample room to think the future will offer good static typing abilities for Clojure. Also, I find your response unnecessarily curt.
- grovehaw 8y agoYou may want to check out Typed Racket as an example of what people can do if they decide they want types in their lisp. [0] [0] https://docs.racket-lang.org/ts-guide/ https://docs.racket-lang.org/ts-guide/
- pka 8y agoFor Clojure, check out Ghostwheel [1] - a lightweight DSL for writing specs. If you want proper static typing though, ReasonML might be a good choice. Static, compiles to js and native, super easy to learn, and there’s an experimental Lisp frontend with Clojure-like syntax if you can’t live without paredit. [1] https://github.com/gnl/ghostwheel https://github.com/gnl/ghostwheel
- hellofunk 8y agoTo me, core.spec has valid uses, but not as a replacement for static tying.
- pka 8y agoI agree, but it’s the best you can get if for some reason you’re stuck with Clojure.
- gnl 8y agoAuthor of Ghostwheel here – clojure.spec is certainly not a replacement for static typing, but it goes a long way to covering many of the same use cases, in fact longer than one might think at a cursory glance. With Ghostwheel you write your function specs similar to how you'd write a type signature and you get automatic generative testing (including higher order function support) and side effect detection which – when combined with spec instrumentation (+ the upcoming evaluation tracing for the test execution) – can often tell you quite precisely where you screwed up in a much more immediate and granular manner than a simple unit test or mucking about in the REPL could. It really is a quite different experience from plain Clojure. That being said, I'd love types in addition to this and I'm keeping a keen eye on ReasonML.
- pleasecalllater 8y agoIf you also add the line count for the additional tests needed to check the behavior of passing not what you expected, then I'm not sure it will be more.