Clarity, compiled.
A readable language that compiles to native code and WebAssembly.
shapes.lcd
choice Shape
Circle(radius: float)
Square(side: float)
Point
task area(self: Shape) -> float
return match self
Circle(radius) -> 3.14159 * radius * radius
Square(side) -> side * side
print Square(side: 3.0).area()lucid check shapes.lcd
shapes.lcd:9:9: error E0316: this `match` does not cover every `Shape`
note: add an arm for `Point`choice Shape
Circle(radius: float)
Square(side: float)
Point
task area(self: Shape) -> float
return match self
Circle(radius) -> 3.14159 * radius * radius
Square(side) -> side * side
print Square(side: 3.0).area()lucid check --json shapes.lcd
[{"code":"E0316","severity":"error","message":"this `match` does not cover every `Shape`","file":"shapes.lcd","line":9,"column":9,"end_line":9,"end_column":21,"notes":["add an arm for `Point`"],"fixes":[]}]choice Shape
Circle(radius: float)
Square(side: float)
Point
task area(self: Shape) -> float
return match self
Circle(radius) -> 3.14159 * radius * radius
Square(side) -> side * side
Point -> 0.0
print Square(side: 3.0).area()lucid run shapes.lcd
9.0Explicit where it matters.
Signatures say what changes, what fails, and what runs on another thread. The compiler infers the rest.
| What it does | What you write |
|---|---|
| Readable by default | task is_adult(self: User) -> bool |
| Inferred ownership, value semantics | var b = a |
| Memory safety without a garbage collector | if index is not none |
| Native code through Cranelift | lucid build hello.lcd |
| WebAssembly for the browser | lucid build --target web hello.lcd |
| Explicit errors, mutation, and concurrency | bump(change total, 3) |
| Diagnostics and tools for agents | lucid check --json main.lcd |
Eight milestones done. The ecosystem is next.
2/9
M8 steps done. M8 adds Linux, a package registry, SQLite, cryptography, a language server, and the 1.0 stability promise.
Read the roadmap- M0DesignDone
- M1Hello worldDone
- M2Core languageDone
- M3DataDone
- M4Ownership performanceDone
- M5A usable languageDone
- M6BrowserDone
- M7Concurrency and serversDone
- M8EcosystemIn progress
- M9Self-hosted front endPlanned
A handful of commands.
Every command also speaks JSON with --json. Binaries are not published yet, and the source repository is not public.
| Command | What it does |
|---|---|
lucid run hello.lcd | Compiles with a JIT and runs it. |
lucid check hello.lcd | Reports errors, and prints nothing when there are none. |
lucid test hello.lcd | Runs the file’s tests. |
lucid build hello.lcd | Writes a standalone executable. |
lucid build --target web hello.lcd | Writes one .js file for a browser or Node. |
lucid explain E0316 | Explains a diagnostic code. |