Limbo (programming language)

From Bauman National Library
This page was last modified on 21 May 2016, at 23:39.
Limbo
Paradigm Concurrent
Developer Bell Labs / Vita Nuova Holdings
First appeared 1995
Typing discipline Strong
License Open source
Website limbo
Influenced by
CSP, Pascal, C, Alef, Newsqueak
Influenced
Stackless Python, Go, Rust

Limbo - a programming language in the Inferno operating system, created by UNIX developers.

Language features

Limbo supports the following features:

  • Modular programming
  • Parallel Programming
  • Strong type checking at compile time and run time
  • Interprocess communication over typed channels
  • Automatic garbage collection
  • Simple abstract data types

Built-in types

  • Byte (8-bit unsigned integer)
  • Int (32-bit signed integer)
  • Big (64-bit signed integer)
  • Real (64-bit floating-point number)
  • Array (array with slices)
  • string
  • Adt (Abstract Data Type)
  • Tuple (tuple)
  • modul

Reference counting and garbage collection

Pointers are replaced by references that dynamically allocate the referenced structures and deallocate. Given both reference counter, and a garbage collection (garbage collection) are used. By reference count is guaranteed that after giving up the last reference the data structure is also released. This is important if the structure contains other resources such as open files that are closed at the latest upon release. If one uses only the garbage collection, the release may be delayed, possibly also not be carried out before the program ends. The timing of the release is not predictable. Reference count on the other hand give cyclic data structures such as ring lists, trees with backreferences etc. not free reliable. Structures can be left that will never be released because they reference each other, but which also can not be accessed. The keyword cyclic removes the restriction and allows the definition of all data structures. For releases of these structures an automatic garbage collection is used.

Examples

Limbo uses Ada-style definitions as in:

 name := type value;
 name0,name1 : type = value;
 name2,name3 : type;
 name2 = value;

Example list:

l : list of int;
l = 10 :: 20 :: 30 :: nil; // Create a list of 3 elements
l = 5 :: l; // Add to the beginning of another
i: = hd l; // Get int equal to 5, the list has not changed
l2: = tl l; // Get a new list of 10 :: 20 :: 30 :: nil is
l2 = tl l2; // Remove from it the first element

Hello world:

 implement Command; include "sys.m";
     sys: Sys; include "draw.m"; init(nil: ref Draw->Context, nil: list of string)
 {
     sys = load Sys Sys->PATH;
     sys->print("Hello World!\n");
 }

External links

  1. Vita Nuova page on Limbo
  2. A Descent into Limbo
  3. The Limbo Programming Language
  4. Inferno Programming with Limbo