4 ms·
JavaScript is functional if you write in functional. There's nothing stopping you from writing pure functional code in JavaScript or TypeScript.
by paradite 4y ago
JavaScript is functional if you write in functional.
There's nothing stopping you from writing pure functional code in JavaScript or TypeScript.
- mikedelago 4y agoI think this is something a lot of people overlook too quickly, too. It's pretty easy to get some of the benefits of FP without using Haskell/Scheme/ML/whatever in a lot of languages: - Write pure functions - Postpone side effects until necessary (as in, set up the side effect in a way that the side effects inputs are testable) - Return things when possible, in order to increase the expressiveness of your code It's also important to not fight the language you're working in. If you're constantly breaking idioms and your teammates can't read your code, FP isn't providing any benefit.
- ParetoOptimal 4y ago> Contemporary imperative languages could continue the ongoing trend, embrace closures, and try to limit mutation and other side effects. Unfortunately, just as "mostly secure" does not work, "mostly functional" does not work either. https://m-cacm.acm.org/magazines/2014/6/175179-the-curse-of-the-excluded-middle/abstract https://m-cacm.acm.org/magazines/2014/6/175179-the-curse-of-...