News for hackers. Stuff that matters.
Re:Proposal: Go should have generics by riffraff on Thursday April 14, 2016 @02:06AM (#11494607)
Single small binaries are easy with go, very hard with java.
Re:Proposal: Go should have generics by pjmlp on Thursday April 14, 2016 @02:42AM (#11494715)
If you have the money, there are lots of commercial JVMs with compilers to native code.

There are quite a few open source ones, but they aren't as stable.

As always, Language != Implementation.

Re:Proposal: Go should have generics by thegenius2000 on Thursday April 14, 2016 @03:41AM (#11494928)
Agreed, but remember that

  Language == Thought-space >= Implementation,
so you want to maximize your language's expressiveness.
Re:Proposal: Go should have generics by fosk on Thursday April 14, 2016 @03:32AM (#11494889)
Could you recommend any that you have had experience with?
Re:Proposal: Go should have generics by sievebrain on Thursday April 14, 2016 @07:57AM (#11495866)
RoboVM is one that compiles AOT ARM binaries, it's intended for the iPhone but it runs on MacOS too.

Avian is a JIT compiling JVM but one which is much smaller than HotSpot. It has a mode where it statically links your JAR into the binary itself, so you get a single self contained executable. With ProGuard and other optimisations like LZMA compression built in, such binaries can be remarkably small. Try their example:

https://readytalk.github.io/avian/#-xamples

It's a full blown GUI app that demonstrates the full range of widgets available, is cross platform, and yet is only about 1mb in size.

Re:Proposal: Go should have generics by bmaupin on Thursday April 14, 2016 @09:21AM (#11496401)
RoboVM can also compile to OS X and Linux:

Usually this means iOS and the ARM processor type but RoboVM is also capable of generating code for Mac OS X and Linux running on x86 CPUs. [0]

There are several forks of the latest open-source version of RoboVM. This one in particular is targeting desktop/server usage:

https://github.com/ashleyj/aura

See also: https://news.ycombinator.com/item?id=7579737

[0] http://docs.robovm.com/advanced-topics/compilation.html

Re:Proposal: Go should have generics by pjmlp on Thursday April 14, 2016 @07:32AM (#11495738)
I just know them from Java conferences.

Excelsior JET is the most well known one.

Oracle actually also supports AOT but only on embedded systems, with the commercial JDK.

Re:Proposal: Go should have generics by rat87 on Thursday April 14, 2016 @02:35AM (#11494688)
Also smaller memory usage.
Re:Proposal: Go should have generics by incepted on Thursday April 14, 2016 @02:12AM (#11494626)
> Single small binaries are easy with go

With static linking? I don't think so.

Re:Proposal: Go should have generics by dikaiosune on Thursday April 14, 2016 @02:27AM (#11494660)
Compared to a JAR with many dependencies and no option for LTO?
Re:Proposal: Go should have generics by sievebrain on Thursday April 14, 2016 @06:19AM (#11495448)
You can make an executable "fat jar" with Capsule. It has a little shell script prepended to the JAR which means you can run it like "chmod +x foo.jar; ./foo.jar"

You can do dead code elimination and other forms of LTO using ProGuard. Just watch out for code that uses reflection. Java 9 will include a less aggressive version of the same thing which performs various link time optimisations like deleting modules (rather than individual methods/fields), statically pre-computing various tables, and converting from JAR into a more optimised (but platform specific) format.

That tool can also bundle a JRE in with your app, giving you an "tar xzvf and run" deployment model. It's not a single file, but it makes little difference in practice. The same tool can build DEBs, RPMs, Mac DMGs and Windows EXE/MSI installers with a bundled and stripped JRE too.

Re:Proposal: Go should have generics by dikaiosune on Thursday April 14, 2016 @12:38PM (#11498181)
I'm a big fan of Capsule, actually. My point was not that Java and the JVM ecosystem are terrible (I quite like them), but rather that there is a spectrum of size and complexity and that Go's static binaries seem to be on the simpler to build side of JARs and on the smaller side of JARs.

Also, I don't think there's much of a case to be made that bundling a JRE with your JAR is small, even though the tooling might be simple and it might resolve many deployment issues.

Re:Proposal: Go should have generics by pjmlp on Thursday April 14, 2016 @02:45AM (#11494730)
Java 9 brings LTO via jlink.
Re:Proposal: Go should have generics by prodigal_erik on Thursday April 14, 2016 @06:55PM (#11500918)
Putting a jar on your classpath works just like depending on a shared library but with much stronger compatibility guarantees and better chances for optimization.
Re:Proposal: Go should have generics by mappu on Thursday April 14, 2016 @02:58AM (#11494775)
Does golang have LTO? (maybe only in gccgo?)
Re:Proposal: Go should have generics by jsmthrowaway on Thursday April 14, 2016 @02:28AM (#11494665)
You think wrong. It was the default of the compiler for a long time and only requires minimal work now.