Ask HN: Are compiler errors for unused code necessary?
Languages like Zig and Go refuse to compile when you don't use an argument in a function, don't use a local variable or have an unused import. This breaks the hypermodern C flow
An common suggestion is a '-no-warn-unused' flag, and the objection is 'if a feature exists, it will be used in production'
I haven't heard of someone suggesting to ignore dead code on 'go run .' and erroring on 'go build', but it looks like the perfect solution
(
3 comments
| 2 points
| on HN
)
I think the flag works fine as a solution.