Re:Go 1.21
by philosopher1234 on Wednesday June 21, 2023 @05:18PM
(#36424716)
They're not reserved keywords. Existing/package defined min/max functions would take precedence. They have the same semantics as `append`
[ Parent
| on HN ]
Re:Go 1.21
by WhereIsTheTruth on Wednesday June 21, 2023 @05:23PM
(#36424800)
You refactored your code, you think you wrote your ``min`` function, but no, it'll call the builtin one, without warning you..
I don't like this design..
The compiler will tell you if the types aren't compatible, and this is only for primitive comparable types. What `min()` implementation could you have that even does something different?
Re:Go 1.21
by KRAKRISMOTT on Wednesday June 21, 2023 @05:54PM
(#36425187)
A heap?
if you have so few tests and so little code review that this matters then I am not sure what to suggest
Re:Go 1.21
by Chiron1991 on Wednesday June 21, 2023 @05:47PM
(#36425104)
Not too familiar with go toolchains, but I bet there's a linter that will warn you about shadowing builtins.
Yep: "variable append has same name as predeclared identifier (predeclared) go-golangci-lint"