Go is a compiled, garbage-collected, concurrent programming language developed by Google Inc. 
- Philosophy - Go  and Lua 
- Type system - Go supports static typing without inheritance or any relationships between types.
- Types - Go has a larger number of builtin types (e.g. integers of various sizes and signedness), whereas Lua code normally just uses the number type (typically floating point). For Lua, see also the [LNUM patch].
- Multiple return values - supported by both languages
- Strings are immutable in both languages
- C/C++ interfacing - Well developed in Lua (BindingCodeToLua). Go can link to C using cgo and SWIG now supports Go. .
- Concurrency - Lua and Go both support forms of coroutines ("goroutines" in Go). Go has channels, making concurrency safer, and the goroutines can be multiplexed over concurrent threads (see GOMAXPROCS runtime option).
- RAII/exceptions - Go's "defer" statement supports execution on scope exit (function not block level) . Lua doesn't natively support it, but see ResourceAcquisitionIsInitialization. Go and Lua don't have a try-catch statement , but the pcall function in Lua is analogous, and similarly the panic/recover construct in Go.
- Standard library - Go is larger  and doesn't limit itself to ANSI C.
- Stability - Go 1 release is stable[] and widely used in production. Lua is a mature language and implementation. See also LuaFiveTwo.
- Compilers - Go has two full stable compilers, the main 'gc' compilers, and gccgo, there is also an llvm frontend in progress: llgo. Lua has LuaImplementations.
- Syntax - Go follows C brace and comment syntax closer than Lua though still deviates from C in many ways .
- Runtime speed - Both Lua and Go emphasize efficiency, especially for the LuaJIT implementation of Lua. Go is readily a compiled language.
- Compilation speed - Both Lua and Go emphasize speed of compilation. Go has a novel approach in handling big project trees, resulting in exponential speed gain.
- Pointers - Go has pointers but no pointer arithmetic, for safety . Lua has no pointers.
- Garbage collection - Both Lua and Go use garbage collection.
- Portability - Lua runs anywhere you have an ANSI C compiler. Go runs on unix-style systems and Windows. A Plan 9 port is on it's way.
- Go has named result parameters  (see also: Multiple Return Values mentioned above).
- Go has Python-style slices.
RecentChanges · preferences
edit · history
Last edited August 16, 2012 10:34 am GMT (diff)