4 ms·
> I sometimes wish I could tighten down some Clojure code with static type guarantees. These are in small, remote portions of the code that have intricate algor
by m12k 9y ago
> I sometimes wish I could tighten down some Clojure code with static type guarantees. These are in small, remote portions of the code that have intricate algorithms. Static types would be very useful there. But that's the exception. In general, I like the flexible information model approach of Clojure better than the statically-typed approach of Haskell.
I feel the opposite way. I find a dynamic approach useful in some places, but in most places I miss having static typing to help catch errors faster and give my IDE better auto-completions and make exploring new APIs faster without constantly needing to look things up. And rather than small intricate algorithms, I find the most important place for static typing to be when making big refactorings that span the whole codebase. I think my ideal language would have static typing by default but you could disable it in places.
- kochthesecond 9y agoMy sentiment as well. Local segments with dynamic typing could be nice, but especially along api borders I want static typing. In most cases static type inference would be enough, I generally don't feel the need for dynamic typing then.
- emidln 9y agoI've been writing Clojure for several years with ^:always-validate'd Schemas at the API boundaries in for library boundaries and compojure-api enforcing the Schemas for input passed in via http or queues (via constructing a ring map out of an input queue and turning a ring response map into a response on a different queue). My tooling (emacs/Spacemacs) has good support for introspection/autocompletion/automatic doc popups/testing and I also get cheap to free generative testing via test.check. The water is nice, you should jump on in.
- mamcx 9y agoMy sweet spot is local type inference (inside functions, methods) and explicit type annotations (for types, parameters, etc), and a way to have a dynamic type with low ceremony, like just sugar over a hasmap....
- weavie 9y agoSo, C# then..
- m12k 9y agoYes, of the languages I've tried, C# and Obj-C/Swift have been the ones that did this best. I'm looking for a functional language with a similar approach, but haven't really found any, so failing that, I'll go with a fully statically typed language instead - I'm considering whether to get started with Haskell, Scala or Ocaml/Reason.
- jjnoakes 9y agoIf you like C#, have you tried F#?
- adamnemecek 9y agoCheck out Kotlin, it might meet your criteria.
- thesz 9y agoHaskell's compiler can defer type errors to the runtime. You can run your partially checked code.
- aeoost 9y agoTry F# my man. In my experience its the best option for a statically typed functional language if you want to actually get stuff done and not just dick around. Also as you're coming from C# it would be the logical choice since the tooling is all there and you're already familiar with it. Visual Studio Code + Ionide plugin is what I use. I really don't understand why F# isn't more popular. Maybe it has something to do with its Microsoft roots making it uncool among the hip functional crowd?
- maxxxxx 9y agoYes, I believe in most cases "dynamic" is evil in but in some cases it's very useful so I am happy to have it when I need it.
- tytytytytytytyt 9y agoScala's local type inference might suit you.