3 ms·
I've never seen an example of this where the developer has actually managed to make their codebase more concise, understandable, testable, extensible, or more r
by austin-cheney 4y ago
I've never seen an example of this where the developer has actually managed to make their codebase more concise, understandable, testable, extensible, or more robust.
This is almost purely functional but makes no attempt to look like anything other than JavaScript and just about everything is identifiable to profilers and covered by some form of test automation.
https://github.com/prettydiff/share-file-systems https://github.com/prettydiff/share-file-systems
- archarios 4y agoThe first bits of code I come across on this codebase isn't functional: https://github.com/prettydiff/share-file-systems/blob/master/lib/common/common.ts#L55 https://github.com/prettydiff/share-file-systems/blob/master.... You're modifying state. You're implementing iteration with do..while loops. That doesn't scream functional to me. Iteration is done with things like Array.map, Array.filter, Array.reduce in functional JS. Higher order functions are key. Functional code is declarative. do..while is imperative.
- austin-cheney 4y agoIt is functional and imperative. Functional does not mean only declarative. There are even functional programming languages that don’t allow declarative style like Rebol and Red. Likewise declarative does not necessarily mean functional. The examples you mention are declarative but not explicitly functional. I get the impression people come to these statements because they read something about functions somewhere once. When you get past the vanity and actually read the code it’s just a bunch of functions and no vanity.