Difference between revisions of "Go"

From RogueBasin
Jump to navigation Jump to search
(Updated some information about Go)
Line 12: Line 12:
== Roguelike Issues ==
== Roguelike Issues ==


Go has several modern programming features, such as garbage collection and closures, which help when developing roguelikes. It has a reasonably simple duck-typing-based object system, which is clean, but doesn't necessarily match the complex problem of roguelike data modeling. The concurrent features aren't much needed in main roguelike logic, which is generally very sequential, but can help when programming an user interface that runs asynchronously with the game logic.
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.


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. As of 2012-07, there is some ARM support, but Go is not suitable for the standard type of Android app development, where native code is compiled into a dynamic library invoked by a wrapper application in Java, since Go code cannot be easily compiled into a dynamic library.
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.
 
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.
There is FFI support for linking to external C libraries like [[SDL]] or [[Curses]]. Calling C code from Go is reasonably straightforward.
 
As of 2012-08, there is a long-standing [http://code.google.com/p/go/issues/detail?id=909 issue] which makes garbage collection occasionally fail and the application to eventually run out of memory with some memory use patterns on 32-bit Go applications. 64-bit applications do not have the problem. This may be an issue for games, which can use complex memory allocations and run for a long time.


== Related Links ==
== Related Links ==

Revision as of 00:06, 6 February 2015

Go
Programming Language
Company Google
Influences C, Python
Updated 2013-08-13 (1.1.2)
Status Stable
Licensing Open Source (MIT License)
Platforms Linux, OS X, Windows, FreeBSD
Official site of Go


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 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.

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. With the help of 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 Termbox-Go library, which provides cross platform lightweight ncurses-like API written in pure Go.

Related Links