3 ms·
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
by NateDad 13y ago
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.
- sirclueless 13y agoSure 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.html http://docs.oracle.com/javase/7/docs/api/java/io/FileReader.... [2]: http://docs.oracle.com/javase/7/docs/api/java/lang/Readable.html http://docs.oracle.com/javase/7/docs/api/java/lang/Readable.... [3]: http://docs.oracle.com/javase/7/docs/api/java/io/Reader.html http://docs.oracle.com/javase/7/docs/api/java/io/Reader.html