Native performance.
Explicit control.
Readable code.

Iron is a general-purpose native programming language for command-line tools, network services, data processing, simulations, and games. Compile to C, manage memory explicitly, and put concurrency to work.

Alpha — expect breaking changes · v4.4.0-alpha · Apache 2.0
app.iron
func main() {
    val samples = [10, 20, 30, 40, 50]
    var total: Int = 0
    for sample in samples {
        total += sample
    }
    println("processed={len(samples)} total={total}")
}

Build software with control and clarity

Native compilation, explicit resource management, and readable code — useful across application domains.

⚡

Native compilation

Iron compiles through C to native binaries with the Iron runtime linked in. There is no Iron VM or tracing garbage collector. Static interface dispatch keeps implementation choices visible to the compiler.

⚙

Control

You manage memory explicitly — stack, heap, reference counting — with compiler-assisted safety nets. No borrow checker, no hidden magic.

▶

Concurrency

Thread pools, parallel loops, and concurrency primitives are first-class language features, not library afterthoughts.

✎

Legible

No operator overloading, no implicit conversions, no hidden control flow. When you read Iron code, you know exactly what it does.

One language, many kinds of software

Start small, explore the libraries, and help shape an evolving language.

Tools and data

Write command-line utilities and data-processing programs with native compilation and explicit resource lifetimes.

Try a native example

Network services

Explore HTTP/HTTPS, WebSocket, TCP, UDP, and file I/O with explicit deadlines and cleanup.

Build a client or service

Simulations and compute

Express numerical work and concurrent tasks with typed values, native code, and first-class concurrency.

Explore concurrency

Graphics and games

Use Raylib for visualization, interactive applications, and games. Graphics are one part of Iron's broader toolkit.

Explore Raylib

Features

Power where you need it

Iron gives you fine-grained control without boilerplate.

Memory, your way

Choose the right strategy for each allocation. Stack by default, heap when you need it, reference counting for shared ownership. Use free or defer free for heap-owned values, and opt into reference counting for shared ownership. Compiler diagnostics and checked pointers help catch lifetime mistakes.

  • Stack allocation by default
  • Explicit free / defer free — explicit lifetime management
  • Opt-in rc for shared ownership
  • defer for deterministic resource cleanup
  • leak for intentional permanent allocations
memory.iron
object Record {
    val id: Int
}

func main() {
    val local = Record(1)
    val owned = heap Record(2)
    defer free owned
    val shared = rc Record(3)
    val also = shared
    println("local={local.id} owned={owned.id} shared={also.id}")
}

First-class concurrency

Named thread pools, typed channels, mutexes, and parallel loops are built into the language. No external threading libraries, no callback pyramids.

  • Named thread pools with CPU pinning
  • Typed channels for safe message passing
  • parallel loops with automatic work distribution
  • Compiler prevents mutable captures in parallel blocks
concurrency.iron
func sum_to(n: Int) -> Int {
    var total = 0
    for i in range(n) {
        total += i
    }
    return total
}

func main() {
    val task = spawn("summary") {
        return sum_to(100)
    }
    val total = await task
    println("total={total}")
}

Compile-time evaluation

Move supported computations out of the runtime path. Use comptime to evaluate constants and pure expressions when compiling, and keep configuration values close to the code that uses them.

  • Evaluate supported pure functions with comptime
  • Embed files directly into the binary
  • Build lookup tables at compile time
  • Same function works at runtime and compile time
comptime.iron
val BUFFER_BYTES = comptime (64 * 1024)

func main() {
    println("buffer bytes={BUFFER_BYTES}")
}

Networking, batteries included

First-class stdlib for HTTP/HTTPS, WebSocket/WSS, TCP, UDP, DNS, typed IP addresses, and RFC 3986 URLs. Errors are concrete values, never exceptions. Timeouts are deadlines the runtime actually honours, from DNS through TLS and message decoding.

  • TCP client / server with non-blocking sockets and monotonic deadlines
  • Verified HTTPS and WSS clients plus TLS-backed servers
  • REST, webpage, WebSocket text/binary, ping/pong, and close models
  • UDP and dual-stack IPv4/IPv6 listeners
  • DNS on an elastic thread pool with stuck-worker abandonment
  • Pure-Iron URL parse, build, resolve, and percent codec
  • Explicit result values, errors, and resource cleanup
net.iron
import net

-- resolve a hostname with a 2s budget
val (addrs, err) = Net.lookup_host("example.com", 2000)
if err.code != 0 { return }

-- dial + write, tuples everywhere
val (sock, derr) = Net.tcp_dial("example.com", 80, 2000)
if derr.code != 0 { return }
defer TcpSocket.close(sock)

TcpSocket.write(sock, "GET / HTTP/1.0\r\n\r\n", 1000)

-- pure-Iron RFC 3986 URL handling
val (u, _) = Url.parse("https://example.com/path?q=iron")
println(u.host)    -- "example.com"
println(u.query)   -- "q=iron"

Get started in seconds

Install Iron with a single command, then run your first program. macOS and Linux supported.

hello.iron