A language and runtime for cross-platform apps and tools.
Develop on a live VM that keeps your program's state as you edit, ship one codebase as native executables or WebAssembly, and call C and C++ directly.
function main() { final tasks = ["Buy milk", "Write the report", "Call the plumber"]; for (task in tasks) Sys.println('- $task'); }
$ haxeon tasks.hx
- Buy milk
- Write the report
- Call the plumber
Cross-platform UI
Change the code. The app keeps going.
Run your app with haxeon run --watch --live and save a change: the running app takes the new code and keeps what it was doing. Try it here: tick a task, type a draft, then apply the edit.
Tasks
UI that looks the same everywhere
The ui package draws on the GPU, with real text handling built in.
Native services from the OS
Each platform's own services, through one API.
Packages
From the haxeon registry, versioned with the toolchain.
The native services layer is pre-1.0; its API is still changing.
Typed, expressive, and quick to write.
Static types with inference, value types, pattern matching, null safety and deterministic cleanup, compiled fast enough to edit while it runs.
A struct is a value: == compares its fields and it works as a map key. The compiler writes the equality and hashing.
struct Point implements Hashable { public final x:Int; public final y:Int; public function new(x:Int, y:Int) { this.x = x; this.y = y; } } final names = [new Point(0, 0) => "origin"]; Sys.println(new Point(1, 2) == new Point(1, 2)); Sys.println(names[new Point(0, 0)]);
true origin
Enums carry data, and switch takes them apart. Miss a case and the compiler names it.
enum Shape { Circle(radius:Float); Rect(w:Float, h:Float); } function area(s:Shape):Float return switch s { case Circle(r): Math.PI * r * r; case Rect(w, h): w * h; }
area(Rect(2, 3)) → 6
A value that can be null says so in its type. After the check, the compiler knows it is not.
function greet(name:Null<String>):String { if (name == null) return "Hello, stranger"; // name is a String from here on return 'Hello, $name (${name.length} letters)'; }
greet("Ada") → Hello, Ada (3 letters)defer runs when the block exits, however it exits: a return, a break or an exception.
function work() { Sys.println("open"); defer Sys.println("closed"); Sys.println("working"); }
open working closed
Pass any type to MessagePack or JSON and the compiler writes its codec: no annotations, no reflection. When the data must last, haxeon lint --fix --pin-wire numbers its fields so renames stay compatible, and old data still reads.
typedef Task = {title:String, done:Bool}; final task:Task = {title: "Buy milk", done: false}; final bytes = MessagePack.encode(task); final json = JsonWire.encode(task); final back:Task = MessagePack.decode(bytes); Sys.println('${bytes.length} bytes: ${back.title}'); Sys.println(json);
22 bytes: Buy milk
{"version":1,"value":{"title":"Buy milk","done":false}}Typed RPC over the same codecs: a method is a permanent id with a request and response type, the server registers it, the client calls it. Handshake, capabilities, cancellation and reconnect are built in; any transport carries it.
typedef Query = {name:String}; typedef Answer = {text:String}; final greet:RpcMethod<Query, Answer> = RpcMethod.wire(100); server.register(greet, (request, context) -> context.respond({text: 'Hello, ${request.name}'})); client.call(greet, {name: "Ada"}, 1000, answer -> Sys.println(answer.text), error -> Sys.println(error.code));
Hello, Ada
Everything is checked statically, and Dynamic is there when data has no schema: parsed JSON, plugins, scripts.
final data:Dynamic = haxe.Json.parse( '{"name": "Ada", "langs": ["Haxeon", "C"]}'); Sys.println(data.name); Sys.println(data.langs.length);
Ada 2
An abstract gives a value a meaning and methods, and compiles to the plain value underneath.
abstract Meters(Float) from Float { public inline function toFeet():Float return this * 3.28084; } final height:Meters = 1.8; Sys.println(height.toFeet());
5.905512
Call C and C++ without a bridge.
Point Haxeon at a header. Structs keep their C layout, strings cross as UTF-8, and handles the library owns close exactly once.
geometry.h
typedef struct geo_point { double x; double y; } geo_point; /* The distance between two points. */ double geo_distance(const geo_point *a, const geo_point *b); /* Moves point by (dx, dy) in place. */ void geo_translate(geo_point *point, double dx, double dy);
Main.hx
import Geometry; function main() { var origin = new Point(); var corner = new Point(); corner.x = 3.0; corner.y = 4.0; var d = Geometry.distance(origin, corner); Sys.println('distance: $d'); Geometry.translate(corner, 1.0, 1.0); Sys.println('moved to: ${corner.x}, ${corner.y}'); }
Output
$ haxeon run
distance: 5
moved to: 4, 5Develop live, ship native or WebAssembly.
Develop on the VM
haxeon run --watch --liveA fast JIT VM that starts at once and takes your edits while the program runs.
Ship a native executable
haxeon build --build-mode=releaseCompiled ahead of time through C into one executable, with the VM linked in.
Build WebAssembly
haxeon build --target wasm32A .wasm module, not a JavaScript bundle. Experimental.
| Platform | Status | Live editing |
|---|---|---|
| Linux (x86-64, arm64) | Supported | Yes |
| macOS (Intel, Apple Silicon) | Supported | Yes |
| Windows (x86-64) | Supported | Yes |
| Android (arm64-v8a, x86_64) | Supported | Yes |
| Web (WebAssembly) | Experimental | Not yet |
| iOS | In progress | Not yet |
The whole toolchain, in one command.
Everything ships with Haxeon and works the same in the editor and on the command line. No plugins to assemble.
Language server
haxeon lspCompletion, go to definition, diagnostics as you type. The VS Code extension uses it.
Debugger
Breakpoints, stepping, watchpoints, logpoints and exception breaks, even across a live edit.
Formatter and linter
One house style, and checks that know your types.
Profiler
haxeon run --profileA timeline of your running program, opened in Perfetto or in VS Code.
Build and test
Incremental builds through a compile server that stays warm.
Packages
haxeon add uiA registry, version ranges and a lockfile. Publish with haxeon publish.
C and C++ bindings
haxeon ffi importBindings generated from headers.
Setup check
haxeon doctorNames what is missing and the command that installs it.
The same language, beyond apps.
Tools
haxeon create my_tool -t consoleCommand-line programs, built into one executable.
Games and 3D
Tune a game's logic while you play it.
Scripts
haxeon script.hxOne file, no project, started at once.
Embedding
Run Haxeon inside an existing application.
Three steps to a running app.
Install
Unpack a release and put its
binon your PATH.haxeon doctorchecks your C toolchain.Create
haxeon create my_appA windowed app for Linux, macOS and Windows.
Run and edit
haxeon run --watch --liveChange
src/Main.hxand watch the app update.