Skip to content

inko-lang/inko

Repository files navigation

Inko logo Inko

Inko is a language for building concurrent software with confidence. Inko makes it easy to build concurrent software, without having to worry about unpredictable performance, unexpected runtime errors, or race conditions.

Inko features deterministic automatic memory management, move semantics, static typing, type-safe concurrency, efficient error handling, and more. Inko source code is compiled to machine code using LLVM.

For more information, refer to the Inko website or the documentation. If you'd like to follow the development of Inko, consider joining our Discord server.

Examples

Hello world:

import std.stdio (STDOUT)

class async Main {
  fn async main {
    STDOUT.new.print('Hello, world!')
  }
}

A simple concurrent program:

class async Calculator {
  fn async fact(size: Int, output: Channel[Int]) {
    let result = 1.to(size).iter.reduce(1, fn (product, val) { product * val })

    output.send(result)
  }
}

class async Main {
  fn async main {
    let calc = Calculator()
    let out = Channel.new(size: 1)

    # This calculates the factorial of 15 in the background, then we wait for
    # the result to be sent back to us via a channel.
    calc.fact(15, out)
    out.receive # => 1307674368000
  }
}

For more examples, refer to the website.

Installation

Details about how to install Inko and its requirements can be found in the "Installing Inko" guide in the Inko manual.

License

All source code in this repository is licensed under the Mozilla Public License version 2.0, unless stated otherwise. A copy of this license can be found in the file "LICENSE".