Thursday, November 12, 2009

So like Google's Go is from Mars: A first glance

Well, I heard about the new language Go this afternoon, and it sucked a bit of time that I'm really short on. First note is that Go is from Mars. Take this sample from the tutorial:

for i := 0; i < flag.NArg(); i++ {
if i > 0 {
s += Space
}
s += flag.Arg(i);
}


Personally, I've never seen curly-based syntax without parens on fors and ifs. Just doesn't seem right to me. There's some other style in the language that's new to me. It looks so strange that I'd almost think it were an April Fools joke ... if it were April 1st, I guess.

But to get past the initial shock of alien appearance, here's my take at a first glance. This is based on their docs. I haven't actually tried it out.

The good:

  • Pure interface, simple struct, no-inheritance, straight functions OO. If you've read other posts on my blog, you can imagine I'd love this. I'm glad someone was brave enough to try it out.

  • Super fast compiler. C and C++ stink in this arena.

  • Fast execution, supposedly near native.

  • Lightweight threads and message passing, a la Erlang. Scalability should be sweet.

  • Normal goodies like closures and type inference.

  • Opinionated in some things: UTF-8 source, public/private by naming convention (caps for public).

  • Fairly simple namespacing.

  • BSD licensing.

  • It's from Google. Google has $$$$$$. They can push things forward.



The bad:

  • The syntax. It's just grating to me at this point.

  • Too much focus on ad hoc solutions rather than general principles.

  • No concept for nullable pointers vs. not.

  • No operator overloading.

  • No easy interfacing to C++.

  • Is it cross-platform (meaning at least Windows, Mac, and Linux) yet? I'm not sure.



The ugly:

  • Um, no exception handling. Seriously. So, um, expect to have to manually check for errors all the time. Which means, expect average programmers to ignore lots of errors and write buggy code.

  • Well, I'd complain about this if there were exceptions, but there's no mechanism for automatic resource cleanup (beyond garbage collection) that I could find. Less need without exceptions, but it still seems like a glaring hole to me. Also, if the closures and
    anonymous functions are good enough, maybe I'm also overstating this one.



Probably forgetting something.

Between the ugly and the fact that they aren't really production-ready yet, I think I'll just keep a watch on it for now. What I really want is language that IDE-friendly and human-friendly, compiles and runs like lightning (including fast starts and low memory usage), and instantly consumes C and C++ libraries. Oh, and doesn't make it painfully easy to ignore errors.

No comments:

Post a Comment