Wyn

1 language for everything

Ship CLI tools, web services, desktop apps, mobile apps, and games — from one language, on every platform.

v1.7.0 MIT License Cross-platform .wyn & .🐉

— Install —

$ curl -fsSL https://wynlang.com/install.sh | sh
> irm https://wynlang.com/install.ps1 | iex
27
official packages
260+
methods
2Ξs
spawn time
62ms
cached compile
5
platforms
Fast
Native binaries. No VM, no GC. 1.4s compile (PCH). 2Ξs spawn. Single binary, no runtime. Cross-compile to Linux, macOS, Windows, iOS, Android.
Simple
Script mode (no main needed), pipe operator, defer, enums with data, list comprehensions, arrow lambdas. Clean syntax, zero boilerplate.
Powerful
Generics with monomorphization, traits, spawn/await concurrency, destructuring match, Result/Option with ?, parameterized SQL.
Complete
HTTP, JSON, SQLite, Redis, JWT, GUI, raylib, logging — 27 official packages. Install with one command.
Tooled
REPL, deploy, doctor, benchmarks, HTML doc gen, test runner, formatter, package manager. VS Code and Neovim with LSP. Friendly 🐉 Wynter tips in errors.
— Wyn —
test "math operations" {
    assert(1 + 1 == 2)
    assert_eq(3 * 3, 9)
}

test "string methods" {
    assert_eq("hello".upper(), "HELLO")
    assert_eq("hello".len(), 5)
}

fn greet(name: string = "world") -> string {
    return "hello ${name}"
}

test "default parameters" {
    assert_eq(greet(), "hello world")
    assert_eq(greet("wyn"), "hello wyn")
}
struct User {
    name: string
    age: int

    fn greeting(self) -> string {
        return "Hi, ${self.name}!"
    }

    fn is_adult(self) -> int {
        return self.age >= 18
    }
}

fn main() {
    var users = [User{name: "Alice", age: 25}, User{name: "Bob", age: 17}]
    for u in users { println(u.greeting()) }
}
fn main() {
    // List comprehensions
    var squares = [x * x for x in 0..10]
    var evens = [x for x in 0..20 if x % 2 == 0]

    // Slice syntax
    var first3 = squares[0:3]          // [0, 1, 4]
    var hello = "hello world"[0:5]   // "hello"

    // Functional chains
    var data = [1, 2, 3, 4, 5]
    var result = data
        .filter(fn(x: int) -> int { return x > 2 })
        .map(fn(x: int) -> int { return x * 10 })
    println(result.join(", "))       // 30, 40, 50
}
trait Drawable {
    fn draw(self) -> string
}

struct Circle { r: int }
struct Rect { w: int, h: int }

impl Drawable for Circle {
    fn draw(self) -> string { return "circle" }
}
impl Drawable for Rect {
    fn draw(self) -> string { return "rect" }
}

// Dynamic dispatch — any Drawable
fn render(shape: Drawable) { println(shape.draw()) }

fn safe_div(a: int, b: int) -> ResultInt {
    if b == 0 { return Err("divide by zero") }
    return Ok(a / b)
}
fn compute(n: int) -> int {
    var sum = 0
    for i in 0..n { sum = sum + i }
    return sum
}

fn main() {
    // Spawn 3 parallel tasks — 2ξs each
    var f1 = spawn compute(100000)
    var f2 = spawn compute(200000)
    var f3 = spawn compute(300000)

    var total = await f1 + await f2 + await f3

    // Channels for message passing
    var ch = Task.channel(10)
    Task.send(ch, total)
    println(Task.recv(ch).to_string())
}
// Numbers
var answer = 42.to_string()          // "42"
var absolute = Math.abs(-5)          // 5
var power = Math.pow(2, 8)           // 256
var rounded = Math.round(3.7)        // 4

// Strings
var clean = "  hello world  "
    .trim().capitalize()              // "Hello world"

var shout = "hello"
    .upper().replace("L", "*").reverse()  // "O**EH"

// Arrow lambdas
var nums = [1, 2, 3, 4, 5]
var doubled = nums.map(fn(x) => x * 2)       // [2,4,6,8,10]
var big = nums.filter(fn(x) => x > 3)        // [4,5]

// Chain everything
var result = "HELLO"
    .lower().capitalize().len()
    .to_string()                          // "5"
fn main() {
    // Fetch + parse + store in 10 lines
    var body = Http.get("https://api.example.com/users")
    var doc = Json.parse(body)
    var name = Json.get(doc, "name")

    var token = Encoding.base64_encode("user:secret")
    var hash = Crypto.sha256(body)

    var db = Db.open("app.db")
    Db.exec(db, "INSERT INTO users(name) VALUES('${name}')")

    var csv = Csv.parse(File.read("data.csv"))
    println("Saved ${name}")
}

How Wyn Compares

Honest numbers. All benchmarks reproducible — source in the repo.

17×
less memory than Go at 1M tasks
153 MB vs 2,636 MB
60×
faster than Python
52 ms vs 3,200 ms (fib 35)
8×
smaller binary than Go
222 KB vs 1.8 MB
260ms
compile time (Rust: 5–30s)
Bundled TCC, zero deps

Full Comparison

MetricWynGoRustPython
Hello world binary222 KB1.8 MB300 KBN/A
Fibonacci(35)52 ms48 ms35 ms3,200 ms
1M concurrent tasks153 MB2,636 MB—N/A
Dev compile260 ms300 ms5–30 sN/A
REST API (lines)451208535
Deploy to production1 command4+ steps4+ steps5+ steps

🔗 Write Once, Use Everywhere

Write it in Wyn, ship it as a native library for any language.

Python extension
wyn init mylib --lib python
Node.js addon
wyn init mylib --lib node
C shared library
wyn init mylib --lib c
Wyn package
wyn init mylib --lib wyn

Write performance-critical code in Wyn, use it from Python, Node, or C. Wyn generates the bindings for you.

GitHub Documentation Packages Sample Apps Downloads