3 ms·
How does Go lack correctness?
by mgummelt 9y ago
How does Go lack correctness?
- AnimalMuppet 9y agoI think danieldk specified what he meant: Lack of generics means that you have to copy and paste. He defines "forces you to copy and paste due to lack of generics" as "incorrect for a language". I think he's stretching the definition of "correctness" past the breaking point, but that clearly was what he meant.
- piaste 9y agoNil pointers?
- danieldk 9y agoSome examples: - You can accidentally implement an interface. - Lack of a proper ownership model can lead to unexpected results, which leads to bugs. Consider e.g. growing of slices: https://play.golang.org/p/3qfd5B8_ktK https://play.golang.org/p/3qfd5B8_ktK - nil is not equal to nil: https://golang.org/doc/faq#nil_error https://golang.org/doc/faq#nil_error (Obviously, it is is easy to move the goalposts without a proper definition of 'correctness' ;).)
- cdoxsey 9y agoI think correctness is the wrong word. Maybe safety would be better? (Verboseness? Precision?) Go is quite a stable language. Well-specified, rigorously tested, and conservatively updated. I think all the behavior you listed is well-defined, albeit perhaps unexpected. Lack of generics doesn't make code incorrect. Less clear maybe, or easier to make a mistake. Or clearer and a lot more code. I guess you could argue that it makes writing correct code harder?