3 ms·
I write lots of Java and Go. I much prefer writing Java where I have things like "sets" and lambdas. I also find the type system to be a lot better in Java. In
by ronnier 7y ago
I write lots of Java and Go. I much prefer writing Java where I have things like "sets" and lambdas. I also find the type system to be a lot better in Java. In Go I'm often left wondering what I'm looking at and don't know unless I dive down into the source.
- johnisgood 7y ago> I also find the type system to be a lot better in Java. In Go I'm often left wondering what I'm looking at and don't know unless I dive down into the source. Could you please provide an example in both Go and Java? I am not quite sure that it has to do with the type system itself but your familiarity with the language and its libraries, and/or lack of basic functionality that should be in your text editor when you write Go.
- ronnier 7y agoGo: value := getValue() Java: int value = getValue()
- johnisgood 7y agoYou could do: var value int = getValue() Alternatively, use your text editor. For me, even Emacs displays the type when my cursor is on or around value, and if you put it on or around getValue(), you get its function prototype that includes its return type.
- ronnier 7y agonobody does that though. And that was the simplest example. Once you get into more complicated types things get even harder to understand.
- lossolo 7y agoFrom Java 10 this is valid Java also: var value = getValue() So it's almost exactly the same in both languages. It's not a problem for most IDEs, just hover your mouse over the value or use keyboard shortcut to get the type. This was never an issue for me in Java or Go.