3 ms·
I think that's how interfaces work. You define an interface by the methods a receiver has (a struct complying to the ReadCloser interface for example must impl
by patrickg 13y ago
I think that's how interfaces work. You define an interface by the methods a receiver has (a struct complying to the ReadCloser interface for example must implement Read() and Close()). While one has to get used to it, it works very nicely in practice.
- fauigerzigerk 13y agoI don't think so. Interfaces dispatch based on the type of the one and only special purpose receiver.
- Arnor 13y agoI've read this sentence 6 times and have no idea what it means...
- nostrademons 13y agoIt means that one argument to the function is special, syntactically, and it is that argument (and only that argument) that determines whether a type implements an interface.