3 ms·
> There is nothing magical about functional programming How come not? I read that F# gives you compiler exception when you didn't match all possible values. Or
by jve 4y ago
> There is nothing magical about functional programming
How come not? I read that F# gives you compiler exception when you didn't match all possible values. Or when you didn't handle __maybe__ cases. JS even doesn't mind comparing strings with ints and incorrectly summing them together and not throwing a runtime exception less alone a compiler complaint.
"1" == 1
true
"1" + 1
'11'
- dmitriid 4y agoThese are peculiarities of type systems, not of functional or non-functional programming.
- jve 4y agoWell, we are talking about functional programming improving program correctness. Such behavior doesn't help. Better choose another language that is a fit for it.
- jvanderbot 4y agoYou can add error checking (e.g., compiler exceptions), but you cannot remove the parts of JS/other languages that cause that error checking to be important in the first place, not without fundamentally breaking the language/existing libraries. TFA describes a paradigm where those features don't exist, and so the error checking is not important. That's a truly safe language. It's also hypothetical at this point, IMHO.
- innocentoldguy 4y agoI view this as one of JavaScript’s myriad flaws. Adding “1” to 1 is nonsensical and the result of “11” is even more so.