Hacker News new | past | comments | ask | show | jobs | submit login

Functional programs don't make this easier.

And don't say "monad transformer stacks" somehow solve this problem in an easier way.




Not necessarily because it is functional, but Erlang makes this vastly easier.

I find the "oh you changed tiny piece of logic, you should totally have to refactor every line of code that follows it" very strange. It obviously sucks, there are far better ways to handle it and they are slowly making it into the language.


Erlang makes it easier because it enforces no shared state between actors, and each actor has it's own independent thread of control.


Haskell definitely makes it easier. You can use preemptive green threads with almost all the ease of cooperatively multitasked code because of the prevalence of immutability.

You get the performance benefits of non-blocking code. The simplicity benefits of blocking code. And (almost) none of the threading hell you get in imperative languages.


Are they really preemptive? How does the scheduler decide when to switch?


Yeah, they are preemptive (though there had been a long-standing bug where threads that have no allocations don't get preempted, I believe it is fixed now).

This is some documentation of the scheduler: http://blog.ezyang.com/2013/01/the-ghc-scheduler/




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: