Go allows you to define methods separately from the structure / data type on which they work. Does this simply mean flexibility in placing method definitions or something more?
I heard that the Go struct / methods system is compared with a monkey patch, but if I understand correctly, then you really cannot add methods to an existing type (struct), since the methods must be in the same package as the type, i.e. You can patch monkeys only those types that are under your control anyway. Or am I missing something?
In what cases do you define a type and its methods in separate source files (or in different parts of the same source file)?
Aivar source share