Alexander Solovyov: Go: static duck typing and more

published May 11, 2012

Alexander Solovyov talks about the Go language at PyGrunn. Is it just Python plus static typing?

See the PyGrunn website for more info about this one-day Python conference in Groningen, The Netherlands.

This is a Python and friends conference, so this is a talk about the Go language.

Go was announced in November 2009, so very new. Ken Thompson and Rob Pike have worked on it, known for working C, Unix, Plan 9, etc.

It is somewhat conservative:

  • using {braces}
  • imperative
  • static typing
  • 'unhurried' innovativity

Go is pragmatic:

  • it compiles fast
  • has garbage collection
  • it has a convenient type system
  • concurrency primitives
  • extensive standard library
  • using UTF-8 everywhere

You declare interfaces and types.

You can achieve concurrency with channels and 'go' routines. [Looks simple enough to me, Maurits.] He shows how to handle errors; he likes the exception handling less than in Python. With an unscientific benchmerk for an HTTP daemon Go performed much better than Python in memory usage and requests per second.

Go knows several ways of importing modules, like this, using the 'go' tool:

import {
    "fmt"
    "os"
    "github.com/droundy/goopt"
    "path/filepath"
    "regexp"
    }

Those dependencies are handled during compile time.

Cross-compilation is supported, so compiling for Windows on Linux.

Some problems:

  • there are leaks on 32-bit systems
  • garbage collection is far from perfect
  • due to the name it can be hard to search for on search engines; use 'go lang' as search query

More info: http://golang.org/