Skip to content

Wyn v1.8: Green Threads and Coroutines

February 2026

v1.8 is the biggest release since v1.0. The headline feature is green threads — stackful coroutines with an M:N work-stealing scheduler.

spawn/await

wyn
fn fetch(url: string) -> string {
    return Http.get(url)
}

var f1 = spawn fetch("http://api.example.com/users")
var f2 = spawn fetch("http://api.example.com/posts")
var users = await f1
var posts = await f2

Each spawn creates a coroutine with a 16KB stack. The scheduler distributes work across OS threads. I/O operations (HTTP accept, socket read/write) automatically yield the coroutine and resume when data is ready.

Channels

wyn
var ch = Task.channel(10)
spawn fn() {
    for i in 0..100 {
        Task.send(ch, i)
    }
}
for i in 0..100 {
    var val = Task.recv(ch)
}

Channels are typed, buffered, and coroutine-aware. Sending to a full channel yields. Receiving from an empty channel yields. No busy-waiting.

Performance

We benchmarked against Go 1.24 on an M4 Mac:

  • Spawn 1M tasks: 247ms / 2MB (Go: 279ms / 12MB)
  • fib(35) with PGO: 48ms (Go: 57ms)
  • Binary size: 32KB (Go: 2.3MB)

The memory advantage comes from pooled 16KB stacks and batch work-stealing.

I/O event loop

The runtime includes a kqueue (macOS) / epoll (Linux) event loop. When a coroutine does a blocking I/O operation, it parks itself and the scheduler picks up other work. When the I/O completes, the coroutine resumes.

This means Http.accept() in a spawned task doesn't block other tasks. You get concurrent I/O without callbacks or async/await syntax.

What else is new

  • wyn bench command with min/avg/median/p99 stats
  • wyn doc --html with sidebar, search, dark mode
  • wyn fmt code formatter with --check mode
  • Package lockfile (wyn.lock)
  • WebSocket and JWT packages
  • Online playground at play.wynlang.com
  • 28 official packages
  • Source maps — runtime panics show .wyn file and line number
  • Math.checked_add/sub/mul for overflow detection
  • TOML parser in stdlib

Install

bash
curl -fsSL https://wynlang.com/install.sh | sh

Full changelog: CHANGELOG.md

MIT License