3 ms·
While Go has first-class functions and the like, functional programming is discouraged in Go; it's not optimized for it in either the language or the compiled r
by Cthulhu_ 2mo ago
While Go has first-class functions and the like, functional programming is discouraged in Go; it's not optimized for it in either the language or the compiled result. It doesn't have tail call optimization for example, and naive functional coding may look "nice" (especially if it had for example arrow function syntax), but it won't have "mechanical sympathy". That is, no functional code (in Go) will be as fast as just iterating over a slice.
[0] has some good reasonings too, with history.
[0] https://www.reddit.com/r/golang/comments/c2a7b0/why_isnt_go_functional/ https://www.reddit.com/r/golang/comments/c2a7b0/why_isnt_go_...]