Skip to content

Wyn v1.15: The Payloads Release

v1.14 gave optionals and results their clean return-type syntax. v1.15 makes sure they actually hold any scalar — and clears a papercut that could bite you the moment you named a function connect. Everything here is backward compatible — no source changes are required to upgrade.

Any scalar in an Option or Result

Until now, only int and string payloads worked inside an Option or Result. A function returning float? — the kind of thing you write without a second thought — simply wouldn't compile. That's fixed: float?, bool?, Result<float, _>, and Result<bool, _> now work in every position.

wyn
fn half(x: float) -> float? {
    if x < 0.0 { return None }
    return Some(x / 2.0)
}

fn divide(a: float, b: float) -> Result<float, string> {
    if b == 0.0 { return Err("division by zero") }
    return Ok(a / b)
}

They match in both statement and expression position:

wyn
var result = divide(10.0, 4.0)
var msg = match result {
    Ok(v) => "quotient ${v}",
    Err(e) => "error: ${e}",
}
println(msg)                           // quotient 2.5

And the method API works — .is_some(), .unwrap(), .unwrap_or(default):

wyn
println(half(-1.0).unwrap_or(0.0))     // 0.0

Bools too:

wyn
fn parse_flag(s: string) -> bool? {
    if s == "on" { return Some(true) }
    if s == "off" { return Some(false) }
    return None
}

Your function names are yours

Because Wyn compiles to C, a function named connect, read, write, socket, send, listen, or index used to collide with the C standard library and fail with a baffling error:

error: static declaration of 'connect' follows non-static declaration

No more. Those names — and the rest of the POSIX/libc set — are now yours to use. The compiler transparently namespaces the generated C, so nothing in your Wyn code changes:

wyn
fn connect(host: string) -> string {
    return "connected to ${host}"
}

fn read(n: int) -> int {
    return n + 1
}

Name things the way your domain reads best; the compiler stays out of the way.

Upgrading

bash
wyn --version        # 1.15.0

No source changes are required. v1.15.0 is a drop-in upgrade over v1.14.0.


Read the full what's new in v1.15, or browse the version history.

MIT License — v1.16