3 ms·
Here's an example from the official Go documentation on using closures in the same sort of place - https://golang.org/pkg/net/http/#example_ServeMux_Handle http
by vertex-four 6y ago
Here's an example from the official Go documentation on using closures in the same sort of place - https://golang.org/pkg/net/http/#example_ServeMux_Handle https://golang.org/pkg/net/http/#example_ServeMux_Handle
- jtdev 6y agoYes, closures are present in many languages, but they are pervasive and unavoidable in Swift. You’re avoiding addressing the idea that closures actually cause layers of (often unnecessary) indirection, make code more difficult to reason about, and make code harder to read - especially for jr. devs.
- fauigerzigerk 6y agoWhat worries me is not so much the somewhat excessive use of closures itself but rather the combination of closures and the potential for circulcar references. https://news.ycombinator.com/item?id=21919728 https://news.ycombinator.com/item?id=21919728
- vertex-four 6y agoNo, I'm suggesting that you've not shown they must be used any more than in other languages - and obviously in order to make sense of the examples in Go's documentation you've got to know how they work, and Go is pretty much the language designed for junior backend devs.