4 ms·
Why does 'interface{}' feel unlike 'interface{String() string}' to you? Just because it doesn't have a method? You know that you can inline non-empty interfaces
by mseepgood 5y ago
Why does 'interface{}' feel unlike 'interface{String() string}' to you? Just because it doesn't have a method? You know that you can inline non-empty interfaces, too?
func foo(x interface{String() string}) string {
return x.String()
}
- xmprt 5y agoI think people agree that those look similar however the problem is that the first is a common practice while the latter is something that no one in their right mind would do. If people replace the second with something like Stringer, then the first should be replaced too.
- nkozyra 5y agoI think you (and the other reply) are for some reason confusing my complaint as functional rather than purely syntactical.