3 ms·
I don’t think Haskell or OCaml are more verbose than Python. Other traditional languages are adopting type inference, etc. We could be near an inflection point
by melling 8y ago
I don’t think Haskell or OCaml are more verbose than Python.
Other traditional languages are adopting type inference, etc. We could be near an inflection point where we get statically type languages that are as convenient as Python.
- bayesian_horse 8y agoOh sure, but Haskell and OCaml are much less popular than Python, with consequences for community building, recruiting, reusing existing code bases etc. The popular statically typed languages which are actually Python's competitors are for example C++, C#, Java and the like. Sure as hell they are more verbose. Even Typescript was extremely intimidating to me when I started to try and understand Typescript code bases. And I am NOT going to try and teach Haskell or Ocaml as a first programming language...
- lerax 8y ago> I don’t think Haskell or OCaml are more verbose than Python. I love Haskell computing model, but holy hell, why is so difficult using things like State Monad or even a trivial thing like a global counter [1] ? Why something so simple should be so difficult? Don't say it's because functional programming, Scheme/Racket is not that difficult! Haskell and OCaml has their own problems, I agreed with you that both languages are more expressive but the code density is not necessary a good thing neither. [1]: https://github.com/scotty-web/scotty/blob/master/examples/globalstate.hs#L68 https://github.com/scotty-web/scotty/blob/master/examples/gl...
- thinkpad20 8y agoA global counter is difficult because shared global mutable state should be difficult —- it can wreak havoc on your code. That said, if you’re really set on it it’s not particularly bad counter :: IORef Int counter = unsafePerformIO (newIORef 0) usesGlobalState :: IO () usesGlobalState = do count <- readIORef counter putStrLn (“the counter was “ ++ show count) modifyIORef (+1) counter It’s even easier in ocaml, where you’d use ref and not need to worry about the IO monad. Anecdotally, I find it incredibly rare that such a thing is desirable, when you could instead create it in an IO monad and pass it through to functions that need it. But, it’s there when necessary. And making this kind of anti pattern hard is a strength of these languages, not a weakness.