4 ms·
Really glad to see some of these new packages (sort, map, etc) making use of generics. Should reduce the need for a lot of helper functions. Also really excite
by tastysandwich 3y ago
Really glad to see some of these new packages (sort, map, etc) making use of generics. Should reduce the need for a lot of helper functions.
Also really excited to see loop capture variables finally getting sorted out. It is a constant pain point with new devs, and I have no good answer when they ask "but WHY is it like this?"
More information about loop capture here for those interested https://github.com/golang/go/discussions/56010 https://github.com/golang/go/discussions/56010
- yencabulator 3y ago> "but WHY is it like this?" Because, historically, it's been like that all over, it's not just Go. For example, Python has the same loop variable reuse. Probably comes from a time when compilers were a lot simpler, and all local variables were allocated stack space for the whole duration of the function call.