6 ms·
When I first learned of Go I thought it had a very narrow use case. The language is basically simplified Java (or a reinterpretation of Java), and works on the
by pron 13y ago
When I first learned of Go I thought it had a very narrow use case. The language is basically simplified Java (or a reinterpretation of Java), and works on the same level of abstraction. It's not low-level like C/C++ or Rust, and not high-level "productive" like Clojure. It seemed like Java sans JVM, and as Java developers know, the JVM is the best thing about Java (some would say its only grace). It lacks the JVMs runtime profiling and monitoring tools, as well as the JVMs most powerful features of dynamic class loading and runtime bytecode instrumentation. Its only advantages, as I saw them, were a much reduced startup time and a lower barrier to entry for beginners; its only use case, I thought, was for writing fast command-line apps. Most people who seemed excited by Go were Python and Ruby developers who liked the speed boost and the easy set up.
Now I think Go actually has some very good use cases. While I would never dream of developing a large, complex or critical app on any platform other than the JVM, the fact that Go produces self-contained executables makes it very convenient sometimes. Fast command-line programs are actually not too narrow a use case, and Go is not useful just for those. I can see myself using it for other small web or network services as well. I still think Go is a JVM-less Java, or a Java Lite, but apparently Java Lite is a very useful thing to have.
- pjmlp 13y ago> Its only advantages, as I saw them, were a much reduced startup time Even that can be solved when using one of the many native compilers available for Java. As the OpenJDK does not have one, people tend to forget other vendors have them.
- bmurphy1976 13y agoHow does having a "native" compiler reduce the startup overhead of the JVM? That doesn't make any sense. It may reduce compile times, but ultimately the reason startup sucks is because the JVM is huge and has to load everything and the kitchen sink in order to function for even the smallest programs.
- pjmlp 13y agoBecause when you compile to native code ahead of time: 1 - There is no JVM 2 - All the code that is not used is not part of the binary, if you do a static build 2.1 - There are native compilers for Java where you can give exclusion lists to allow certain code to be kept even in static builds to allow reflection use
- bmurphy1976 13y agoOK, we are not talking about the same thing. I was thinking along the lines of a compiler written in a native (non-jvm) language ala jikes but you are referring to a compiler that compiles to a native executable ala gcj. I've experimented with gcj in the past. It still suffered from excessive overhead, still had it's own runtime requirements (although obviously not the same as the JVM) and had a lot of serious compatibility issues. Not something I would have based a serious production deployment off of personally. Maybe the state of the art has changed since then.
- pjmlp 13y agogcj was a toy compiler, a 2nd class citizen on the supported gcc languages, left to rotten. It was never at the same level as commercial Java native compilers.
- balfirevic 13y agoCan you recommend some good native compilers? Excelsior[1] is the only one that I've read good things about, but I haven't tried it. [1] http://www.excelsior-usa.com/ http://www.excelsior-usa.com/
- pjmlp 13y agoI know a few from conferences, but never used them on projects myself. Besides Excelsior, there are Aonix PERC, IBM J9, Codename One, JamaicaVM, RoboVM. There are probably a few others. Mark Reinhold mentioned on his "post Java 8" talk at Java One, that having an AOT compiler as part of the standard JDK is part of the wishlist.
- mwcampbell 13y agoAvian (http://oss.readytalk.com/avian/ http://oss.readytalk.com/avian/) also has an AOT compilation option.
- Touche 13y agoI use Lua for fast command-line programs. If that were to not be fast enough (and I'm not sure Go is faster than Lua but let's assume it was), I'd go with Rust which manages to be both lower-level and higher-level than Go at the same time.
- pron 13y agoThere's no doubt Rust is more "important" than Go in the sense that it may have a much greater impact on the software community, but the two languages don't seem to be comparable at all, and they certainly don't compete. Rust is more complicated than Go (it should be, as its more ambitious), and aimed to replace C/C++. Go, as I said, is Java Lite (and like Java, a blue-collar language). Go is great when you want to write a smallish, self-contained Java program and want to spare yourself writing a startup script and requiring (or packaging) the JVM. (I don't know anything about Lua)
- dded 13y ago> Go, as I said, is Java Lite Or Python+. Interesting all the comparisons to Java, with me coming from an environment where Java is never used, never considered, largely never thought about. If Java is mentioned at all, it's usually something like "my kid took a programming class in college, and they used Java, why would they use something like that?". I suppose Cobol was like that: widely used, very widely used, but not used at all in many circles.
- pron 13y agoUnlike Cobol there are few circles where Java, or at least the JVM, isn't used. The ones that come to mind are .Net shops, hardware/embedded shops, very specialized applications (scientific, etc.), console game developers, or – and this is probably the largest one – small(ish) web startups: your Ruby/Python/Javascript crowd before they need to scale. Many of those in the last group would still have some Java/JVM.
- dded 13y ago
- barrkel 13y agoIt's not very like Java at all. The only OO-like feature it has is interfaces, which are more like Haskell's type classes combined with existential types than anything else. (The resemblance here is actually very close, implementation-wise: roughly, vtables at the per-instance level rather than per-class level). The other semi-interesting things it has are (a) channels + parallel functions and (b) the return of error codes for error handling. Java things it doesn't have start with reflection, bytecode (CPU independence), dynamic runtime code generation, inheritance hierarchies, generics, "everything is an object", array covariance, exceptions as an idiomatic error propagation scheme, scoping based on nested namespaces, no code outside of classes, nested types with scoping to match, inner classes with implicit outer class self pointer, only value parameter semantics, and only reference user-defined types. In fact most of what makes Java distinct from the subset it shares with C is missing, except for a garbage collector.
- NateDad 13y agoNot sure if I'm reading your response incorrectly... but go has reflection. I'm not sure what you mean by scoping based on nested namespaces.... Go has similar scoping to pretty much every other modern language. Are you saying java has no code outside of classes? Because Go has that (and doesn't have classes). Also... Go has OO features. You can make an object-like thing by tying data (a struct) with behavior (methods tied to the struct). It doesn't have inheritance which is not the same as not having OO features.
- barrkel 13y agoI think you think I'm criticising Go. I'm not. Beyond that, I think you misunderstood my response.
- NateDad 13y agoYeah, I figured I was misunderstanding you. It seems like you were giving a list, half of which was stuff Go didn't have and half of which java didn't have.... anyway, no big deal, just trying to clarify.
- pron 13y ago
- jamra 13y agoThe people being excited by a language have nothing to do with what the language is like. I see Go as a C-like language with some of the annoyances cut out and a garbage collector added. You don't have pointer arithmetic, but you still have pointers. When you look at it that way, the lack of generics is not so annoying. The best part of Go is the fact that it forces error checking.
- azth 13y ago> The best part of Go is the fact that it forces error checking. Except that it doesn't. Otherwise you would be forced to check the return type of fmt.Printf() and gang.
- jamra 13y agoOk. So idiomatic go returns multiple values with an intention to return an error type. I guess fmt.Printf() is an exception. For the most part, it does as well as C does.
- azth 13y ago> For the most part, it does as well as C does. Which isn't saying much really :) There is absolutely no way to force you to handle errors in Go.
- stcredzero 13y ago>> > The best part of Go is the fact that it forces error checking. > Except that it doesn't. Depending on the value of "forces" used. Maybe "forces" in the sense of "only viable option for someone not programming foolishly."
- eonil 13y agoI also once had this idea. Because Go is mostly the only matured language which can describe processes and pipes in a program with solid flow control. But still, it doesn't feel nice to interact with shell…
- eonil 13y agoI also once had this idea. Because Go is mostly the only matured language which can describe processes and pipes in a program with solid flow control. But still, it doesn't feel nice to interact with shell…