How is implicit better than explicit interface implementation?

Hey,

I just became aware, that there is no “official” way of implementing an interface explicit. What is the reason for that or how is it better than explicit interface implementation?

In my opinion readability and IDE support (can’t jump to interface implementation) both suffer from it…

As per a recent Reddit comment, one reason for not making interface implementation explicit is so that you don’t end up having to write

type MyStruct struct implements io.Closer, io.ReadCloser, io.ReadSeeker, 
  io.ReadWriteCloser, io.ReadWriteSeeker, io.ReadWriter, io.Reader,
  io.Seeker, io.WriteCloser, io.WriteSeeker, io.Writer { ... }

In my opinion readability and IDE support (can’t jump to interface implementation) both suffer from it…

Sounds like you might want Go Guru and some editor/IDE glue?

2 Likes

Thanks, the reason provided given by the reddit comment does not really satisfy me as the case is really theoretically imho, at least optional explicit interface implementation would be nice, well, anyway it’s just like that.

And thanks, for the Go Guru hint. Too bad the jetbrains plugin does not make use of it yet… Learning VIM is already on the to learn list so one more reason to give it a go :slight_smile:

Thanks, have a good time

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.