Skip to content

Wyn v1.11: The Developer Experience Release

v1.11 is about making developers productive in their first hour. Better error messages, new syntax sugar, and tooling that works from any directory.

enum.to_string() Returns the Name

The most-requested fix. Previously, Color.Red.to_string() returned "0". Now it returns "Red".

wyn
enum Status { Active, Inactive, Pending }

var s = Status.Active
println(s.to_string())  // "Active"

Every enum gets a generated string table at compile time. Zero runtime cost for enums you don't call .to_string() on.

Indexed Iteration

Python has enumerate(). Go has for i, v := range. Now Wyn has:

wyn
var fruits = ["apple", "banana", "cherry"]
for i, v in fruits {
    println(i.to_string() + ": " + v)
}
// 0: apple
// 1: banana
// 2: cherry

Works with any array. The index variable is always int.

String Repeat Operator

wyn
println("ha" * 3)       // "hahaha"
println("-" * 40)        // separator line
println("=" * 40)
println("  Report Title")
println("=" * 40)

Simple, readable, no method call needed.

Optional Type Syntax

int? is sugar for OptionInt:

wyn
var x: int? = OptionInt_Some(42)
var y: int? = OptionInt_None()
println(OptionInt_unwrap_or(y, 0).to_string())  // 0

Missing Return is Now an Error

This was a silent bug factory. In v1.10:

wyn
fn get_value() -> int {
    // Warning: may not return a value
    // Compiles! Returns garbage at runtime.
}

In v1.11, this is a compile error. No more silent garbage values.

Type Errors from Wyn, Not C

wyn
var x: int = "hello"

v1.10 showed a cryptic C compiler error. v1.11 shows:

Error: Type mismatch at line 1
  Expected: int (integer)
  Got:      string (text string)
  Suggestion: use .to_int() to parse the string

Static Constructors Work

wyn
struct Point { x: int, y: int }

impl Point {
    fn new(x: int, y: int) -> Point {
        return Point { x: x, y: y }
    }
}

var p = Point.new(3, 4)  // Just works

Previously this generated broken C code. Now the compiler correctly detects static vs instance methods.

Tooling

wyn build shows size and time:

✓ Built: myapp (49KB, 362ms)

wyn test works from any directory:

bash
cd my-project
wyn test    # finds tests/ and runs them

wyn fmt --check for CI:

bash
wyn fmt src/ --check  # exit 1 if unformatted

Better error for missing packages:

Error: Package 'redis' not installed
  Run: wyn pkg install redis

Typed Arrays

var arr: [int] = [] now uses a specialized WynIntArray with raw long long* storage — no type tags, no boxing. Sum of 1M ints is 2x faster than v1.10.

Upgrading

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

No breaking changes except:

  • Functions with missing returns now fail to compile (add the missing return)
  • enum.to_string() returns the variant name instead of the integer value

MIT License