4 ms·
I am going to call bullshit on this: 1) Function argument order is not an issue in practice. Especially Elixir or OCaml providing keyword arguments. Also, ther
by higerordermap 6y ago
I am going to call bullshit on this:
1) Function argument order is not an issue in practice. Especially Elixir or OCaml providing keyword arguments. Also, there are mostly conventions eg search term comes first in replace function.
Elixir, F# all provide Pipes, while little more verbose than dot notation, more universal than methods on objects.
2) IDE support: above points apply, although pervasive type inference may make few things hard. It is best practice to annotate function signatures.
The real reasons why FP languages are unpopular are:
1. immutability is often a bad abstraction and some FP languages often make performance/memory reasoning harder[0].
2. Your 9-5 engineer doesn't want to learn anything more than what they learned in school or bootcamp.
3. The impression created by some FP language communities. There are some people always talking some complicated category theory stuff that's rarely useful for programming, or propagating zero information statement like "If it compiles it works". [1]
[0] "bUt ItS lIKe gRaDuAtE aBsTrAcT mAThEmAtICs it must be good and elegant even if the machine doesn't work like this". Go and learn some real computer science, algorithms, data structures, number theory, probability, instead of touting your definitions of undergraduate logic and set theory.
[1] There is more chance it works, sure. But "If it compiles, it works" is dishonest statements.
- SZJX 6y agoYeah I agree that those two points don't make much sense whatsoever. Though I also don't agree with your point 1. I don't know if you have had much experience writing a functional language professionally. The benefit of immutability is exactly to make reasoning about your program much easier. Of course as you mentioned computers are indeed based on the von Neumann model, so in the end we sometimes have to go into memory usage details. However, unless you're programming some high-performance game, the vast majority of programs run totally fine with mostly immutable data structures. It's also especially suited for distributed computing (e.g. actor model) which is becoming the norm nowadays. In 95% of programming activities, the traditional "real computer science (what is "fake" computer science?), algorithms, data structures, number theory, probability" are used surprisingly rarely, while the elegance of functional/mathematical reasoning really makes the programming experience much more enjoyable and bug-free.
- higerordermap 6y ago> In 95% of programming activities, the traditional "real computer science (what is "fake" computer science?), algorithms, data structures, number theory, probability" are used surprisingly rarely Yeah, unfortunately, the cheap webshits use reverse loops because they read in some medium article that comparison to zero is shorted, while repeatedly concatenating strings in an inner loop. Doesn't help with things like - indexing on utf-8 strings is O(n) and often the compiler/JIT is not able to figure out all necessary loop fusions for you. Basic algorithms, data structure knowledge is a must for every programmer. I don't say they should know how to prove a treap is 0.yz times more efficient than a skiplist. Now the next part. > while the elegance of functional/mathematical reasoning ... There is natural reasoning and there is category theory stuff that only serves to signal the dude has studied some aBsTrAcT mAtHeMaTiCs in programming communities. A best example of this is Haskell. They bastatdized quicksort to show an "elegant example" on their website. Another example is react. "React is fast omg virtual DOM". Not everyone will have latest macbook pro like hipster webshits. I know, and I acknowledge the improvements in craft of ~~CRUD WEBSHIT~~ programming that came from FP camps. But there is also lot of bullshit there in FP camps.
- nyanpasu64 6y agoImmutability makes updating deeply nested data structures more difficult, since you have to update every level with the updated copy of one of its children.