Programming and Computer Science: an imminent divorce?(blog.txus.io) |
Programming and Computer Science: an imminent divorce?(blog.txus.io) |
Since when does Functional === Computer Science?
Even more, I wouldn't use immutable functional programming for writing an OS. An OS is all about mutating state that keeps track of resources.
For that matter, I wouldn't use functional programming in any situation where the nature of the problem cried out for mutating state.
I wouldn't use garbage-collected code to write a memory manager. I wouldn't use it to write crypto code (leaving old crypto data hanging around in memory is a major no-no).
But we get these loud zealots who tell us that FP is The One Right Way, and that we're stupid and/or ignorant if we don't convert at once. I suspect that a lot of people with experience just tune them out, because it's so obvious that what they're saying is unrealistic. But if they were a bit more aware of the variety of the real world of programming, and knew where FP worked and where it really didn't fit, they might get more of a hearing.
It's nice to see these two words used to describe the benefits of functional programming. One often hears "expressivity" and it's less clear to me what that means, precisely.
Even in embedded systems, is it useful to have functions that don't depend on state? Can they simplify design, reasoning, and testability? Certainly.
So even in the domains I mentioned, you can do FP to the extent that the problem domain allows, and benefit from the smaller state space. My quarrel is with the "you must use it everywhere or you're just an ignorant heathen" zealots, not with FP itself.
I'd want to know a bit about how it held up in practice before I gave a real opinion, and I don't know anything about that at present.