I think the big big result from this study is: "Python: half the size !". A dynamic language like Python is better here, 2x better. I assume similar results would apply to other dynamic languages like JavaScript, Lisp, Smalltalk, Groovy etc. This does not say that static typing should not be used but I think it shows unequivocally that there is a considerable extra development cost associated with static typing. You…
Comparing the Same Project in Rust, Haskell, C++, Python, Scala and OCaml
271–280 of 384 posts
Re: Comparing the Same Project in Rust, Haskell, C++, Python, Scala and OCaml
#272Earlier quoted context omitted.
Tangentially - do you know how fast her compiler was compared to the compiled-language implementations? I have a vague sense that for many applications, interpreted languages are totally fine and reaching for a compiled language is premature optimization, but I'm curious how it actually holds up for a compiler, which is more computationally heavy than your average web app or CLI.
Yep, the takeaway for me was that the Python project required far less code, but we're not sure how fast it ran. Further below, the author states the inputs were so small it didn't matter. What if it did? Would the Python solution still be viable?
Re: Comparing the Same Project in Rust, Haskell, C++, Python, Scala and OCaml
#273Haskell without lens, text, vector, etc... is a bit like rust with only core not std. The haskell standard library is tiny. Libraries like lens are not optional. In practice you won't understand any open source Haskell without rudimentary understanding of lens. I get why parser libraries were banned, but excluding lens, vector, and text? I like Rust a lot, but haskell minus it's more advanced type system is just Rust…
Complete baloney. Haskell does not allow any imperative programming. Haskell is functional and disallows imperative, Rust supports functional but is largely imperative. Rust is vastly superior to Haskell and I say this as someone who has put many hours in both languages at this point.
Also, its*.
Re: Comparing the Same Project in Rust, Haskell, C++, Python, Scala and OCaml
#274Earlier quoted context omitted.
> However it is much easier to get what is a dictionary compared to a random "optic". This is exactly what I disagree with. We come from a prior understanding of mutable/imperative dictionary/shared_ptr/std::pair, because that's what we started out with. Had we been initially been trained on monads, functors, lenses, those would be the familiar tools, and we'd go "Huh, that's an... interesting way to write code" when…
Lenses don't really give you anything that you can't get from (a) a sensible syntax for record updates and (b) intrusive pointers. Lenses only exist because of Haskell 98's uniquely bad support for record types. Record access and update in most other languages just is simpler.
The main problem with lenses is that common lens libraries look extremely complicated at first glance and seem to be solving a very simple problem. That rightfully puts most people off of learning what all the fuss is about.
Re: Comparing the Same Project in Rust, Haskell, C++, Python, Scala and OCaml
#275Earlier quoted context omitted.
Not at all. Several languages Rust included takes understandable errors seriously. I am a Rust newbie but the errors are extremely easy to grasp and fix my code.
You say "not at all", but only cite Rust (which I didn't mention). C++ has horiffic error messages, certainly at the level of a bad Haskell error message. I'd say my point stands pretty well.
Re: Comparing the Same Project in Rust, Haskell, C++, Python, Scala and OCaml
#276Earlier quoted context omitted.
Not at all. Several languages Rust included takes understandable errors seriously. I am a Rust newbie but the errors are extremely easy to grasp and fix my code.
You say "not at all", but only cite Rust (which I didn't mention). C++ has horiffic error messages, certainly at the level of a bad Haskell error message. I'd say my point stands pretty well.
Good luck with that :)
Re: Comparing the Same Project in Rust, Haskell, C++, Python, Scala and OCaml
#277I'm surprised that OCaml takes 1.0-1.6x, given originally Rust compiler was prototyped in OCaml...
It mentions that this is almost entirely due to interface files on ocaml’s part. They unfortunately introduce a fair amount of duplication.
On the other hand, in languages like C we couldn't exclude header files because they include macros. (Although I suppose a fancier comparison could count macros and exclude function signatures.)
Re: Comparing the Same Project in Rust, Haskell, C++, Python, Scala and OCaml
#278Earlier quoted context omitted.
> I think the big big result from this study is: "Python: half the size!". I would agree, if and only if I thought a representative sample of Python programmers would all produce something of a similar size and just as correct, but I suspect, in this case, it's the result of one especially talented person.
Raw talent and prior experience no doubt had something to do with it, but there's also the fact that the Python programmer was working alone and not particularly concerned about code quality or maintainability.
Re: Comparing the Same Project in Rust, Haskell, C++, Python, Scala and OCaml
#279Haskell without lens, text, vector, etc... is a bit like rust with only core not std. The haskell standard library is tiny. Libraries like lens are not optional. In practice you won't understand any open source Haskell without rudimentary understanding of lens. I get why parser libraries were banned, but excluding lens, vector, and text? I like Rust a lot, but haskell minus it's more advanced type system is just Rust…
Re: Comparing the Same Project in Rust, Haskell, C++, Python, Scala and OCaml
#280Earlier quoted context omitted.
It's difficult to write a fair comparison without being a fairly competent programmer in each of the languages. The trouble is, if a person is an expert C programmer and then translates it to Python that he's only modestly familiar with, the Python program will look like C. It won't be idiomatic Python. For example, my early Fortran programs looked like Basic. My early C programs looked like Fortran. My early C++ pro…
How do you like D btw? Is it worth learning for a c++ programmer? I find the syntax very appealing.
I was a former C++ full-time programmer (4 different jobs in high performance teams, high maintenance etc) and now I'm a D full-time programmer for 4 years.
It's easy to underestimate the difference, but to me _as a user_ those languages are night and day as an experience.
D is learnable, in the sense that your learning will have some sort of ending at one point. D is surprisingly stable too, the front-end doesn't change too much and all 3 compiler share the front-end. And it's somehow forgiving. So the whole experience is tilted towards what you do with it: you feel like "programming", not "programming in C++".
C++ has a few things going for it: it has some sort of mathematical completeness, you can find jobs maintaining C++ codebases for your retirement, and it has an aura of legitimacy. But overall I fear you would live in a much more complicated world, for reduced productivity.