Go, a Programming Language by Google

Retirado do blog Google Blogoscoped. Incrível como eles criam coisas e mais coisas úteis para os profissionais das mais variadas áreas. Até onde eles vão? De onde eles tiram tanta inovação e idéias? rs.

Google has released a new programming language called Go. Google wants to offer a couple of benefits from their language: fast compilation, easy analyzing of dependencies, static types that nevertheless feel more lightweight compared to some other languages, and multi-core machine support.

Go is not (not yet anyway) an approved official Google-internal language, but apparently more of an experiment for “adventurous users”, started in September 2007 by Robert Griesemer, Rob Pike and Ken Thompson. The motivation for a new language is explained at the Go site:

Go is an attempt to combine the ease of programming of an interpreted, dynamically typed language with the efficiency and safety of a statically typed, compiled language. It also aims to be modern, with support for networked and multicore computing. Finally, it is intended to be fast: it should take at most a few seconds to build a large executable on a single computer. To meet these goals required addressing a number of linguistic issues: an expressive but lightweight type system; concurrency and garbage collection; rigid dependency specification; and so on. These cannot be addressed well by libraries or tools; a new language was called for.

Why doesn’t Go offer generic types? Google explains that the language does not offer them yet, but that they may well be added at some point. The site says:

Generics are convenient but they come at a cost in complexity in the type system and run-time. We haven’t yet found a design that gives value proportionate to the complexity, although we continue to think about it. Meanwhile, Go’s built-in maps and slices, plus the ability to use the empty interface to construct containers (with explicit unboxing) mean in many cases it is possible to write code that does what generics would enable, if less smoothly.

This remains an open issue.

Here’s a bit of Go code to give you an idea, and much more is explained in Google’s tutorials. I’ve just copied some syntax samples into this bit of code, not to create a compilable valid program but for the sake of showing off some of the := declaration syntax, the “missing” if and for brackets, the use of semi-colons as separators but not terminators (the tutorial code seems to be inconsequential about this, or I’m missing something), the implicit break in the switch statement and more:

package main

import fmt "fmt"

const (
    Space = " ";

func main() {
    var s string = "";
    for i := 0; i < 10; i++ {
        if i > 0 {
            s += Space
        s += "foo"

    var a int;
    b := 0;
    c := 0;
    switch {
        case a < b:
            c = -1
        case a == b:
            c = 0
        case a > b:
            c = 1

[Thanks Manoj, DPic and Steffi!]

Atualizado em 13/11/09, as 10h02.

Parece que já existe uma linguagem de programação com o mesmo nome da linguagem criada pelo Google. Foi aberta uma discussão na página de código do Google a respeito do assunto. Para saber mais acerca disso acesse o link:

Code Google: Go page (Issue 9)


Deixe um comentário

Preencha os seus dados abaixo ou clique em um ícone para log in:

Logotipo do WordPress.com

Você está comentando utilizando sua conta WordPress.com. Sair / Alterar )

Imagem do Twitter

Você está comentando utilizando sua conta Twitter. Sair / Alterar )

Foto do Facebook

Você está comentando utilizando sua conta Facebook. Sair / Alterar )

Foto do Google+

Você está comentando utilizando sua conta Google+. Sair / Alterar )

Conectando a %s

%d blogueiros gostam disto: