| ▲ | brodouevencode 2 days ago | |
>First, why would you ever add methods to a public interface? In the go world, it's a little more acceptable to do that versus something like Java because you're really not going to break anything | ||
| ▲ | B-Con 2 days ago | parent [-] | |
If you add a method to an interface, you break every source file that uses a concrete type in place of the interface (ie, passes a struct to a function that takes an interface) unless you also update all the concrete types to implement the new method (or you update them embed the interface, which is yucky). For a public interface, you have to track down all the clients, which may be infeasible, especially in an open ecosystem. | ||