Google New Programming Language "GO"

Google New Programming LanguageGoogle has released a brand-new programming language it hopes will solve some of the problems with existing languages such as Java and C++.

The language is called Go, and it was released under an open source license Tuesday. Google is no stranger to the open source world. The company has released the underlying code for several of its tools and services under open source licenses over the years. Just last week, Google released its Closure JavaScript tools for building Ajax web apps. And now Google has considerably upped its investment in free software with the release of Go, which is an entirely new programming language.

At first glance, Go looks a bit like C++, but borrows some elements, such as garbage collection, from scripting languages like Python and JavaScript. But Go’s real standout feature is its speed. A demo video shows the entire language — over 120K lines of code — compiling in under 10 seconds.

In every declaration, the name comes first, followed by the type. So, for example, types are declared after variable names, and all type modifiers precede the types. So *X is a pointer to an X; [3]X is an array of three X's. The types are therefore really easy to read just read out the names of the type modifiers: [] declares something called an array slice; "*" declares a pointer; [size] declares an array. So []*[3]*int is an array slice of pointers to arrays of three pointers to ints.

Functions in Go are amazing. They start off really simply, but by providing a few simple extensions, they let you do all sorts of things. To start off, here's a factorial function in Go.

func Factorial(x int) int {
if x == 0 {
return 1;
} else {
return x * Factorial(x - 1);
}
}

Go extends that by adding support for named return values. You can declare the return value as a variable in the function header; then you can assign values to that variable. When the function returns, the last value assigned to the return variable is the return value. So you could also write factorial as:

func Factorial(x int) (result int) {
if x == 0 {
result = 1;
} else {
result = x * Factorial(x - 1);
}
return;
}

Go's key features related to concurrency are :

  • Channels.
  • Channels of channels.
  • Goroutines.
  • Leaky buffers.
  • Share by communicating approach.

These features deserve new posts explaining them with more detail. Stay tuned because I'll be adding new posts about Go soon.

Despite its fledgling status, Go already supports many of the standard tools you’d expect from a systems language and even includes support for other Google tools like Protocol Buffers.

Also, it’s worth noting that Google’s Go is not to be confused with an existing language entitled Go! (note explanation point). Google Blogoscoped reports that Go!’s developer Francis McCabe would like Google to change the name of Go, but thus far Google has not responded to that request.

At the moment Go is only available for Linux and Mac OS. If you’d like to learn more, check out the video of Pike’s tech talk below (it’s long, but offers a pretty thorough overview of Go) or head to the new Go website.

Here is GO Programming Language Promo (YouTube)

0 comments:

Post a Comment

Note this

Never Link another websites link in comment otherwise your comment is not approve by admin
Related Posts with Thumbnails
b4teanews.blogspot.com is a multi-user news blog. This blog doesn't host any of the files mentioned on this blog. This blog only points out to various links on the Internet that already exist and are uploaded by other websites or users there. We are trying to avoid copyrighted material. If you found anything abuses matter on this site has been copyrighted or offensive, please contact at sineck111@gmail.com us or leave comment so we can removed or modified or give credit accordingly!
There was an error in this gadget