4 ms·
Some examples: - You can accidentally implement an interface. - Lack of a proper ownership model can lead to unexpected results, which leads to bugs. Consider
by danieldk 9y ago
Some 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?