4 ms·
If none of that convinced, I now remember that John Carmack (who you quoted!) has advocated functional programming as a way to improve the design of your progra
by chubot 5y ago
If none of that convinced, I now remember that John Carmack (who you quoted!) has advocated functional programming as a way to improve the design of your programs (and he also used Racket for a VR project as far as I remember):
https://news.ycombinator.com/item?id=15036591 https://news.ycombinator.com/item?id=15036591
https://www.gamedeveloper.com/programming/in-depth-functional-programming-in-c- https://www.gamedeveloper.com/programming/in-depth-functiona...
As usual he gets to the heart of the matter:
Probably everyone reading this has heard "functional programming" put forth as something that is supposed to bring benefits to software development, or even heard it touted as a silver bullet ...
It isn't immediately clear what that has to do with writing better software. My pragmatic summary: A large fraction of the flaws in software development are due to programmers not fully understanding all the possible states their code may execute in. In a multithreaded environment, the lack of understanding and the resulting problems are greatly amplified, almost to the point of panic if you are paying attention. Programming in a functional style makes the state presented to your code explicit, which makes it much easier to reason about, and, in a completely pure system, makes thread race conditions impossible.
I totally agree and this is why I advocate just using "functional programming" in "object oriented" languages like Python and C++: https://news.ycombinator.com/item?id=11841893 https://news.ycombinator.com/item?id=11841893
That comment won't make sense to anyone who hasn't used a functional language, but I still claim it's a useful way of looking at things.
Related comments: https://lobste.rs/s/lwopua/functional_code_is_honest_code#c_twssec https://lobste.rs/s/lwopua/functional_code_is_honest_code#c_...