Go

From RogueBasin
(Difference between revisions)
Jump to: navigation, search
m (Updates version, platforms, influences, and licensing info)
(A major rewrite of the page. Introduction and Roguelike development sections.)
Line 8: Line 8:
 
|site = http://golang.org/}}
 
|site = http://golang.org/}}
  
'''Go''' is a programming language announced by Google in November 2009. It is a native-code compiled, garbage-collected, concurrent language, born from the developers' frustration with developing concurrent server applications with C++. Version 1 of Go was released in March 2012, and should be a stable target for future applications.
 
  
== Roguelike Issues ==
+
Go (or ''golang'') is a native-code compiled, statically typed, garbage-collected, concurrent programming language created at Google by Rob Pike, Ken Thompson, and Robert Griesemer in 2007. It was born from the developers' frustration with developing concurrent server applications with C++.
  
Go has several modern programming features, such as garbage collection and closures, which help when developing roguelikes. A major focus of the language is compile speed. Compared to compiling C++ code, Go compilation can be several orders of magnitude faster. It has a reasonably simple duck-typing-based interface system, which can lead to very clean reusable code. Currently, Go does not have any form of parametric polymorphism so programmers who are reliant on generics in their data model may have some trouble. The concurrent features such as channels and select are powerful, but often are not much needed in main roguelike logic, which is generally very sequential. It can however help when programming an user interface that runs asynchronously with the game logic.
+
First announced by Google in 2009, version 1.0.0 was released in March 2012, and they currently follow a 6 month release cycle, with new versions being released on February 1 and August 1, so the language should be a stable target for future applications.
  
Go has two compilers, the standalone '''gc''' one and a GCC front-end '''gccgo'''. The official GCC distribution has included the Go front end since version 4.6. The gc toolchain supports Linux, BSD, OS X and Windows on x86-32 or x86-64. Gccgo uses GCC as a backend, and can theoretically target any platform supported by GCC.
+
== Roguelike Development ==
With the help of [https://godoc.org/golang.org/x/mobile/app app package], Go can even be used to target Android devices. There also is good FFI support for linking to external C libraries like [[SDL]] or [[Curses]]. Calling C code from Go is reasonably straightforward. An alternative to [[Curses]] is the execellent [https://github.com/nsf/termbox-go Termbox-Go] library, which provides cross platform lightweight ncurses-like API written in pure Go.
+
 
 +
Go has several modern language features such as garbage collection, memory safety, and closures, with one of its major focuses being on compile speed - often just a few seconds. Compared to compiling C++ code, it can be several orders of magnitude faster. All of which can be a great help when developing roguelikes.
 +
 
 +
The language has a reasonably simple duck-typing-based interface system, which can lead to very clean reusable code. Currently, Go does not have any form of parametric polymorphism so programmers who are reliant on generics in their data model may have some trouble.
 +
 
 +
The concurrent features such as channels and goroutines are powerful, but often are not much needed in main roguelike logic, which is generally very sequential. That said, several areas could gain some benefits, such as game initialisation, dungeon generation, user interface, and other features that can run asynchronously with the game logic.
 +
 
 +
One of the more recent additions to the language that may bring great benefits to roguelike developers is the ability to cross compile for different OS. This means that a game being developed on a macOS system, can compile for Windows and Linux without the need to boot into those operating systems. In the future it will also be possible to use Go to target Android devices.
 +
 
 +
There is also good FFI support for linking to external C libraries like SDL and Curses. Calling C code from Go is reasonably straightforward.
 +
 
 +
For Go developers who wish to use Curses, there is the [https://github.com/rthornton128/goncurses goncurses] library, however a good alternative is the excellent [https://github.com/nsf/termbox-go Termbox-Go], which provides a cross platform lightweight ncurses-like API written in pure Go.
  
 
== Related Links ==
 
== Related Links ==

Revision as of 11:05, 23 July 2016

Go
Programming Language
Company Google
Influences C, Pascal, Python, Smalltalk
Updated 2016-07-18 (1.6.3)
Status Stable
Licensing Open Source (BSD-style)
Platforms Linux, OS X, Windows, FreeBSD, Plan 9, Solaris
Official site of Go



Go (or golang) is a native-code compiled, statically typed, garbage-collected, concurrent programming language created at Google by Rob Pike, Ken Thompson, and Robert Griesemer in 2007. It was born from the developers' frustration with developing concurrent server applications with C++.

First announced by Google in 2009, version 1.0.0 was released in March 2012, and they currently follow a 6 month release cycle, with new versions being released on February 1 and August 1, so the language should be a stable target for future applications.

Roguelike Development

Go has several modern language features such as garbage collection, memory safety, and closures, with one of its major focuses being on compile speed - often just a few seconds. Compared to compiling C++ code, it can be several orders of magnitude faster. All of which can be a great help when developing roguelikes.

The language has a reasonably simple duck-typing-based interface system, which can lead to very clean reusable code. Currently, Go does not have any form of parametric polymorphism so programmers who are reliant on generics in their data model may have some trouble.

The concurrent features such as channels and goroutines are powerful, but often are not much needed in main roguelike logic, which is generally very sequential. That said, several areas could gain some benefits, such as game initialisation, dungeon generation, user interface, and other features that can run asynchronously with the game logic.

One of the more recent additions to the language that may bring great benefits to roguelike developers is the ability to cross compile for different OS. This means that a game being developed on a macOS system, can compile for Windows and Linux without the need to boot into those operating systems. In the future it will also be possible to use Go to target Android devices.

There is also good FFI support for linking to external C libraries like SDL and Curses. Calling C code from Go is reasonably straightforward.

For Go developers who wish to use Curses, there is the goncurses library, however a good alternative is the excellent Termbox-Go, which provides a cross platform lightweight ncurses-like API written in pure Go.

Related Links

Personal tools