Hacker News new | ask | show | jobs
by hhas01 2151 days ago
Indeed. Programming with Functions != Functional Programming.

FP is predicated on referential transparency. FP decides the order of operations, not the programmer. If you don’t have that, you don’t have FP: you’ve got procedural programming with closures. Which is nice, but claiming you’re doing “Functional Programming” smells of this:

http://calteches.library.caltech.edu/51/2/CargoCult.htm

An effective tool is defined as much by what it cannot do as by what it can. In FP’s case, forbidding the unpredictability of mutable-state-over-time permits the automation of higher-level mathematical reasoning, enabling both compiler and runtime to make their own optimizations as they see fit: stronger guarantees of program correctness, deferring costly operations until/if they’re needed, caching the results for fast cheap reuse, parallelizing calculations without fear of races. Powerful stuff, as long as you’re willing to cede a bit of control.

If C and its procedural ilk are all a Swiss Army hammer, declarative programming systems (functional, logic, dataflow, etc) are these:

https://www.reddit.com/r/specializedtools/

A good craftsman should know when to use which; alas, we all too often end up seeing this instead:

https://weblogs.asp.net/alex_papadimoulis/408925