Go and Android
dennisforbes.ca
dennisforbes.ca
The author's approach is interesting, but lacks MIPS support (though would extend successfully to x86 devices, as the author notes).
My almost equivalent attempt was to rebuild the Android NDK (native development kit) toolchain with --language=go added, and built all the GCC/GNU toolchain support for it for all targets. (Granted the rebuild-the-toolchain solution can be a bit hairy if you're not familiar with it.)
I really don't know how many MIPS Android devices there are out there.
The ticket for Go support is open since 2012, so clearly there isn't any interest from Android team to do so.
Many apps also use this method as a way to get around GPL'd code by distributing the GPL executable as a separate runnable application inside the .apk (.zip) file which allows their app to be closed source while containing GPL code.
Yep, you are right, as I have seen too many of these workarounds.
And what is the benefit? Bending ourselves just not to touch Java?!
I rather be productive with the officially supported tools.
I agree completely with productive though. Anybody choosing a language for any reason but the quality of the output is just wasting their own time. Nobody really cares what language you used at the end of the day, only what you produce with it.
JNI
Plus, he also mentioned he has Go code he wanted to reuse.
Or it's just the usual problem that the left hand doesn't know what the right hand is doing. Historically, Google hasn't been so hot at integrating their various projects together, their new round of consolidating crap into Google Plus and Hangouts is both recent and demonstrates that this isn't their field of expertise.
I'm always shocked that Google doesn't throw even more resources behind Android. Android is well-positioned to take on Windows itself... but instead they juggle it and their Chrome platform and keep Android restricted to the tablet/phone space.
The same reason Dalvik is using Java, the pool of potential developpers. Java was definetly a smart choice, wether one likes the language or not. Furthermore android apps can be developped in C++ too.
People use JavaScript to develop mobile apps, for example. The rapid compile times would be great for iterative development and the fast performance might even be better than Dalvik.
Go falls short as a language for mobile in the same ways it falls short as a language for most things. It's simply not a very well-designed language.
Let me give you a few examples:
Terrible support for generic programming. Read almost any production go code and you see many instances of the interface{} type. This is basically equivalent to up-casting to Object in java, or passing things around as null* in C++. In many cases, that's the best you can do. All the type-safety of Python with five times the verbosity.
Many features are built-in, non-extensible language directives. Take the `range` operator. `range` only supports built-in types like maps, slices, and chans. You want to range over a tree? Too bad. Want to range over a graph? Too bad. Want to range over a queue or a linked list? Hmm, well too bad, or maybe wrap the queue or LL with a chan, write a helper function, range over that, and watch your performance go to shit.
Go was built with one purpose in mind; building web services. It's good at that. But really, the only things Go has going for it are decent threading primitives and a solid standard library.
So the answer is this: Go is not a bad language, but it is certainly no better than existing languages for writing mobile applications. Go offers nothing that would make me, if I were a mobile app developer, want to switch from Java or Objective-C. In fact, it's missing a lot of things that I might consider important.
var e elem
for nonrangeable.HasNext() {
e = nonrangeable.Next()
// do stuff with e
}
Coincidentally, that's what the built-in io.Copy [0] does.(I'm also very biased, but I think this approach fits better with the fact that Go is targeted towards stream processing)
Also canonical is building QML support for golang, so they seem to think it's well suited to build apps for Ubuntu http://m.youtube.com/watch?v=HB-3o8Cysec
Go was built with one purpose in mind; building web services.
App Engine is a web service. Whether you agree with that statement or not, it replies your question.
There are a lot more reasons than that.
For one, Go has awful support for any kind of generic programming. The closest thing Go has to proper generic support is the interface{} type, which is awful. It's basically the same type safety as a 100% dynamically typed language (i.e. almost none), but with a much uglier syntax.
A related issue is that Go isn't very extensible. For example, Go's iteration features only work on builtin types. You can't iterate over trees, graphs, sets, or any other non-builtin type.
For me, the only good things that Go offers are decent threading primitives and good standard library support. Nothing else excels, and some things are downright bad.
I might not agree with this comment, but at least his showing the reasons why he dont think Go is a good candidate for mobile development, and his opinion is technical backed
I think this should be in some HN etiquette somewhere.. dont know why people are so sensitive when a comment is not to say something nice about something..
For example, if there are 10 Go developers for every 100 Python developers viewing HN, in a thread such as this one, there may be 9 Go developers for every 5 Python developers. This means that a large percentage of viewers of any critical Go posts in a Go thread are Go developers. They will downvote that critical post almost regardless of content.
This is not a knock on Go developers, merely standard tribalism. There is an identical effect in Haskell, Ruby, or even Perl discussions. There is probably no solution - if you value karma, I recommend not posting critical comments about a language in a post specific to that thread. You should rather save those comments for more general threads about programming theory, etc. If you don't care about karma (and you shouldn't), then please keep posting.
Some people clearly feel quite strongly that generics are a vital part of any language. But they don't really tie into the difficulties of mobile app programming, which are (i) resource contraints, much tighter and differently prioritised to desktop and server programs; and (ii) dealing with GUI libraries, which typically have massive numbers of functions, nests of callbacks, and are generally fiddly to program. Generics can be a help with various algorithms but it's far from clear that they help with mobile-specific issues.
Your parent poster is the typical person who shouts about generics in every Go thread. Like the people who spit bile every time Stephen Wolfram is mentioned in any context, it gets pretty tiresome.
Nothing. Someone said something along the lines of "Go is only bad for mobile because it has bad GUI support." I disagreed.
Mobile development is more than just GUI development.
If the only thing I cared about when writing a mobile app was GUI support, I could write mobile apps in HyperCard.
So, I wouldn't say it needs to support these platforms. Just that not supporting them would be a glaring omission.
And you have to consider that soon everyone will switch to the Gradle build system, which adds amazing possibilities, but also adds a lot of complexity with build types and product flavors on top of the existing complexity with the NDK.
I'm an Android developer (they exist!) and I'll definitely try this out in my next app, just for fun. Anyone have any ideas for something I could do with this that I can't do, or do easily anyway, with a regular Java Android app?
I think this would be a more natural way of doing it, and also be potentially more reusable on other platforms like iOS (which forbid launching processes).
I would be interested in writing a simple HTTP server for my app in Go, and be able to invoke it (start, stop, etc) through a simple C-API. Then I could write the rest of the GUI in the native platform language (Java for Android, Objective-C for iOS).
I think you'd be happier just using sockets to communicate with your Go process. I've done something similar before and it works well.
As I said, spawning processes and IPC isn't an option on all platforms.
Are you sure Go doesn't have this ability?
if thats is true, it means AOT compilation for Dart?