3 ms·
It seems there is a dichotomy in the real implemented world and your hypothetical advice world. Due to lack of native support of defaults for optional methods
by lenkite 1y ago
It seems there is a dichotomy in the real implemented world and your hypothetical advice world.
Due to lack of native support of defaults for optional methods , many interfaces in Go are using hacks for optional methods added by evolution.
The Value interface has a `IsBoolFlag()` optional method not part of the interface signature
The other way for evolution is just add sub-interfaces. Like `io.WriterTo` and `io.ReaderFrom` which are effectively just extensions of `io.Writer` and `io.Reader` with `WriteTo` and `ReadFrom` methods - which are checked for in consumers like `io.Copy`.
Anyways, my point was specifically about generic interfaces and alternative implementations, so it appears you agree.