News for hackers. Stuff that matters.
Re:Interfaces in Go make it hard to navigate code by NateDad on Monday May 27, 2013 @07:14AM (#5774213)
I read the article this way:

I'm brand new to Go. I read neither the os.File documentation, nor the io.Reader documentation, and I'm baffled why I couldn't figure out how to make a File into a Reader.

Re:Interfaces in Go make it hard to navigate code by sirclueless on Monday May 27, 2013 @07:21AM (#5774228)
There's a real complaint here, which is that there's not (yet) any tooling to find all known implementations of an interface, or all known interfaces satisfied by a type. Someday I expect there will be, and maybe this blog post helps spur some of that to be created, so it's certainly not without value.
Re:Interfaces in Go make it hard to navigate code by NateDad on Monday May 27, 2013 @07:36AM (#5774262)
That's true. However, there's no such tooling for any other language, either. There's nothing in Java that says "If you have a file and you need to pass it into something that needs a Reader, use FileReader". You have to do some digging to find the right class. (fudge my class names, I'm not a java guy)

"How do I convert a Foo into a Bar" is a problem in all languages.

Re:Interfaces in Go make it hard to navigate code by sirclueless on Monday May 27, 2013 @09:43PM (#5777545)
Sure there is. For example the FileReader class documentation[1] has a listing of "All implemented interfaces," and the Readable interface documentation[2] has a listing of "All Known Implementing Classes." Pretty much every IDE I know of extends that to include classes from the current package and referenced libraries.

So if you need a Readable in Java ("Reader"[3] is an abstract base class, which incidentally lists all of its known subclasses, including FileReader if you follow through InputStreamReader), you have a ready listing available of all the common implementations, which solves this issue straight away, in a way that Go currently lacks.

There's nothing stopping Go from having this tooling too (with the caveat that interface cross-references would have to be "All known implemented interfaces" instead of "All implemented interfaces"), it's just not there yet.

[1]: http://docs.oracle.com/javase/7/docs/api/java/io/FileReader....

[2]: http://docs.oracle.com/javase/7/docs/api/java/lang/Readable....

[3]: http://docs.oracle.com/javase/7/docs/api/java/io/Reader.html