3 ms·
Disclaimer: I'm a newbie in Haskell. I do, however, have experience in Java, Python, Javascript, and even C/C++. My understanding is that you claim that all th
by mercurial 14y ago
Disclaimer: I'm a newbie in Haskell. I do, however, have experience in Java, Python, Javascript, and even C/C++.
My understanding is that you claim that all these languages can be made to offer you the same benefits as Haskell. I hope I'm not misrepresenting your position, but this is preposterous.
None of these are built around the concept of dumb, immutable data structures and stand-alone function (C/C++ can work with immutable data structures, but most data structures I have seen are mutable). Java is almost completely designed around mutable data structures with associated behaviour (objects), up to the point where you don't have standalone functions.
So, sure, you can have copy constructors everywhere, and static methods (say bye bye to dependency injection...). But it's not idiomatic code. You are fighting against the language and the ecosystem, and the only thing that will likely result is inefficient, bloated code which will get refactored out when it needs to be modified by somebody else than you.
Now, maybe you limit this to your API, but claiming that "the backend implementation is irrelevant for consumers" is a cop-out. Immutable data buys you safety. Maybe you know your code is safe, you don't have any dangling pointer issue anywhere, no concurrency issue, etc. Unfortunately, this might very well not be the case next time you or somebody else refactors your code.
There are certainly reasonable arguments to be made against Haskell (learning curve, Cabal, size of the ecosystem, difficulty of reasoning about performance...). But claiming you get the same benefits in terms of safety out of traditional imperative languages is not one of them. Not to mention higher-level functions, etc, that you certainly are not about to experiment in Java.