4 ms·
>IMO Go is more like C people took a stab at making a Java. I haven't used Go beyond tutorials and some very basic programs, but I am pretty comfortable with J
by tmh88j 7y ago
>IMO Go is more like C people took a stab at making a Java.
I haven't used Go beyond tutorials and some very basic programs, but I am pretty comfortable with Java. What about Go makes you feel it's relatable to Java? From what I've read the lack of generics is a hot topic in the Go community, but they're pretty crucial to most programs written in Java. Is this still true?
- 7thaccount 7y agoGarbage Collector?
- EdwardDiego 7y agoGo's GC is quite different to Java's though - deliberately not as many knobs to twiddle.
- doliveira 7y agoJava didn't have generics before version 5, I think. It was a hell of casting back and forth Object, much like Go and interface{} today.
- correct_horse 7y agoAs a side note, Java also didn't ship with generics. Java was released in the mid 90s and didn't have generics until about 10 years later with version 5. This timing should feel familiar - Go first appeared ~10 years ago in 2009. You may remember that in Java 1.4, `get`ting from collections (e.g. ArrayList) always returned Object, which you were expected to cast to their runtime type (or a class that their runtime type inherits from). I was young at the time, correct me if I'm wrong. Contrast this with Go's solution, which seems to be user-inaccessible compiler magic. I much prefer Go's solution to Java's, but I also like generics.
- saagarjha 7y agoI really hate user-inaccessible compiler magic. Java had its fair share of that, but Go seems to take it even further :(
- Skunkleton 7y agoI think compiler magic is pretty great. Hotspot is a pretty magical compiler. Go is less magical IMO because it is AOT compiled.
- saagarjha 7y agoBy compiler magic I really mean syntax reserved to the language itself; for example, Java's String having extra operator superpowers or Go's generics that are only available to a chosen set of standard collections.
- antoinealb 7y agoI think you can do the same in Go, using the empty interface (that can represent any type) and then having the user cast it to the correct type. Unfortunately this is not type safe, and type safe generics in go, such as maps is only available to the compiler.
- Skunkleton 7y agoThe language and tooling is designed for development at scale. Lots of pragmatic trade offs were made. Its not flashy at all, and could even be accused of being a bit boring. It is also appropriate for a similar domain.
- takeda 7y agoyep, there Go was labeled as a replacement for C or Python, and while it in no way replaces C and and as for Python it generally only does when the Python wasn't the right choice from the start. In reality Go can fully take over Java's problem space.
- qqssccfftt 7y ago> In reality Go can fully take over Java's problem space. Or, when Project Loom releases, Java will be able to fully take over Go's problem space.
- takeda 7y agoSorry, my previous post sounded like I was picking a favorite, what I meant is that Go and Java pretty much has identical problem space.
- pjmlp 7y agoNot really, unless it provides generics, JEE and Spring like frameworks, supports all embedded CPUs, Oracle/SQL Server/DB2, mainframes, has an OS of its own, a GUI half as good as Swing,....
- krakatau1 7y agothere is no way that's happening, outside of silicon valley practically no one is using Go, there are millions Java developers who are quite content with language...
- kelnos 7y agoNot without generics it can't. I know a lot of people seem to think that generics aren't necessary in Go, but I vehemently disagree with them.