News for hackers. Stuff that matters.
Re:Ask HN: Why is functional programming not more popular? by muzani on Tuesday November 05, 2019 @06:52PM (#21458231)
I'd turn the question around. What does functional programming do better? What would you miss about not having it?

I like OOP because it's like boxes where you can just plug one cable from one part into another. It's easy to write "contracts" in, as in assigning what object does what.

There are definitely flaws with this, in that it can get messy, but does FP solve it better? What exactly does FP do better?

Re:Ask HN: Why is functional programming not more popular? by 0_gravitas on Wednesday November 06, 2019 @03:14PM (#21466678)
Immutability is a big one, and I absolutely love things like Elixir's pattern matching and pipe operator, I'll never program the same after coming into contact with them. And I love never really needing to write a loop or to have a "counter" variable, the declarative style just makes things much easier to read, write, and understand imho.
Re:Ask HN: Why is functional programming not more popular? by Joof on Tuesday November 05, 2019 @10:14PM (#21459430)
FP (specifically the Haskell / Scala style) is easier to reason about in large scale applications. In particular, when using distributed systems.

Two reasons:

Immutability guarentees that the variable name changes when the underlying data is changed. Therefore, we don't have to track complicated state through the program or in other threads and processes.

The type system catches many errors at compiletime. Fewer tests and easier to test. The trade-off is that the type system is slightly more complicated. Yes, it does have to be FP to handle this properly (type inference and higher order functions make it manageable).

Re:Ask HN: Why is functional programming not more popular? by valand on Tuesday November 05, 2019 @07:53PM (#21458667)
Might be a little out of topic, but in this video there are some FP concepts being applied to DOD.

https://m.youtube.com/watch?v=g1TsP60z2OQ