Thursday 12 November 2009

Google's Go Language First Impressions

Google recently announced the launch of a new programming language called: Go. Its creators are software heavy-weights like Robert Griesemer, Rob Pike and Ken Thompson. It's a C style language, it has garbage collection and claims to compile fast.

Its idiosyncrasies follow.
  1. Backward declaration: Instead of declaring a variable like "int a", you do "var a int".
  2. Type derivation with ":=". You can initialize variables and Go will derive its type for you. For example doing "a := 1.0" automatically initalizes "a" to a "float".
  3. Semicolons are not required at the end of each statement.
  4. The only looping construct available is the "for" statement. No "while" or "do-while".
  5. The parameters for the "for" and "if" statements don't need to be within parentheses (I'm shocked and crying)
  6. Unicode strings which are immutable.
  7. Pointers but no pointer arithmetic.
  8. Its compiler is currently not available for Windows -- only for Linux and Mac. Doubt if a cygwin port is available.
Maybe more later.

2 comments:

Rake said...

Nice read..interesting excerpts - "By January 2008, Ken had started work on a compiler with which to explore ideas; it generated C code as its output. By mid-year the language had become a full-time project and had settled enough to attempt a production compiler."

Damn a production compiler in 6 months..that's some really fast development!!

Rohit said...

Read carefully dude. It says "settled enough to attempt a production compiler"