3 ms·
Is there any reason Go couldn't allow defining methods on types defined in another package? It seems like you could allow that, gain the property you want, and
by dilap 10y ago
Is there any reason Go couldn't allow defining methods on types defined in another package? It seems like you could allow that, gain the property you want, and still have structural typing.
The confusing thing about this if you did implement it, is if you import a package B that implements more methods for a type in package A, do those methods magically become available to you?
One of the nicest properties about Go currently IMO is that it's always very, very clear where things are defined.