Skip to content

Wyn v1.9: Generators, Debugger, and 36 Packages

Wyn v1.9 completes every phase of the roadmap. Generators, a real debugger, cross-compilation to 5 targets, and 36 official packages.

Generators & Iterators

The yield keyword turns any function into a lazy generator:

wyn
fn fib(count: int) -> iter {
    var a = 0
    var b = 1
    for i in 0..count {
        yield a
        var tmp = a + b
        a = b
        b = tmp
    }
}

fn main() {
    var fibs = fib(10).collect()
    // [0, 1, 1, 2, 3, 5, 8, 13, 21, 34]

    // Chain with map, filter, take
    var squares = fib(20)
        .filter(fn(x: int) -> bool { return x > 5 })
        .map(fn(x: int) -> int { return x * x })
        .take(4)
        .collect()

    // Iterate directly
    for n in fib(8) {
        print("${n}")
    }
}

Generators compile to coroutines — each yield suspends the function and saves its state. Chained .map(), .filter(), and .take() compose without allocating intermediate arrays.

Debugger with DWARF + lldb

wyn debug compiles with full debug info and launches lldb:

$ wyn debug app.wyn
Compiling app.wyn with debug info...
✓ Debug binary: app.wyn.debug

Wyn Debugger — powered by lldb
  n — step over   s — step into   c — continue
  p <var> — print  b <fn> — breakpoint  bt — backtrace

(lldb) breakpoint set --name wyn_main
(lldb) run
* thread #1, stop reason = breakpoint 1.1
    frame #0: app.wyn:6:17
-> 6        var x = add(10, 20)
   7        print("x = ${x}")

The #line directives in generated C map DWARF debug info back to .wyn source files. You see Wyn code, not C.

36 Official Packages

Five new packages join the ecosystem:

PackageDescription
sdlSDL2 helpers — color packing, lerp, clamp, distance
openglOpenGL command builders — viewport, ortho, perspective
wgpuWebGPU descriptors — device, buffer, shader, pipeline
target-iosiOS build helpers — bundle ID, plist, arch
target-androidAndroid build helpers — package, SDK, manifest

All 36 packages have real source code and tests. No stubs.

Cross-Compilation

Build for any target from any host:

bash
wyn build app.wyn --target linux-x64
wyn build app.wyn --target linux-arm64
wyn build app.wyn --target windows-x64

CI now validates all cross-compile targets on every push.

LSP: Find References & Rename

The language server gained find-all-references and rename:

  • Scope-aware: local variables only match within their function
  • Cross-file: searches all open documents
  • Skips strings (but searches inside ${} interpolations)
  • prepareRename rejects keywords

By the Numbers

  • 90/90 tests passing
  • 36 official packages
  • 43 sample applications
  • 10/10 cross-compile targets
  • 27/27 LSP tests
  • 25 book chapters + 4 appendices

MIT License