KonLang Tiếng Việt

Ownership you can read.

As safe as Rust. As fast as C. More readable than both.

Native code, no garbage collector, no lifetime annotations. Every call shows who owns the data. KonLang 1.0.0 is Stable — the compiler now builds itself.

struct Player {
    name: String
    health: i32
}

// view reads, edit changes, take hands over.
func describe(player: view Player) {
    print(player.name)
    print(player.health)
}

func heal(player: edit Player, amount: i32) {
    player.health += amount
}

func main(): i32 {
    var hero = Player { name: String("An"), health: 80 }
    heal(edit hero, 20)
    describe(hero)
    return 0
}
An 100

Safe first

Code without unsafe is meant to be unable to corrupt memory. Moves and borrows are checked when you compile, and errors point at the exact line.

Readable next

The words view, edit and take appear in the code that uses them. There are no lifetime annotations to learn, and one syntax with no statement semicolons.

Then fast and light

List access is compiled inline with its bounds check kept. Small programs stay small, with no heavy runtime behind them.

1.0×C's time on five integer workloads, release builds
~90 KBa simple program, against about 64 KB for C and 4.9 MB for Rust, unstripped, on the benchmark programs
200/200mandatory Stable requirements accepted, with Windows and Ubuntu WSL2 qualification recorded
1 filethe toolchain on Windows: compiler, library, formatter and test runner

Five programs on one machine do not rank languages in general. How these were measured.

Where to go next

Language tourThe whole language by example. Every example on this site is compiled to check it. LibraryText, JSON, networking, files, paths, processes, data structures, graphics and sound. ToolsOne command for building, running, testing and formatting, and a VS Code extension. PerformanceMeasurements against C and Rust, with the method and the limits. CompareNext to Rust, C and Go, including when not to choose Kon. GamesFour small games and a 3D game in Godot, written in Kon to test the language. Status and roadmapStable v1, Windows self-hosting, platform evidence, v2 design freeze and remaining limits. QuestionsCan I use it yet? How is it different from Rust?