Design phase · GPL-3.0
One language for native apps on every platform.
Elp is an open-source programming language in design. Inspired by SwiftUI and Jetpack Compose, it aims to compile one codebase to native apps for iOS, Android, macOS, Windows and Linux, and to HTML, CSS and JavaScript for the web.

A first look
import { Ordering } from elp.types
// Integer minor units. Floating-point currency is a bug waiting to happen.
export object Money {
const cents int,
}
// Conformance is explicit and nominal. `Copy` is field-wise, so `Money` is
// implicitly copyable exactly because `int` is.
Money implements Copy + Add + Comparable
// A method belongs to the package that owns its receiver, and `Self` names
// the receiver's type. There are no constructors, only functions returning one.
export fn Money.zero() -> Self {
return Self { cents = 0 }
}
// `a + b` on a Money is this method. Operators are interface methods, so a
// user type earns `+` by declaring a conformance, never by special case.
export fn Money.add(&self, other &Self) -> Self {
return Self { cents = self.cents + other.cents }
}
// `<`, `<=`, `>` and `>=` all route through this one three-valued method,
// so a Money where `a < b` and `b >= a` disagree cannot be written.
export fn Money.compareTo(&self, other &Self) -> Ordering {
return self.cents.compareTo(other.cents)
}
// `nil` is the only absent value and `Optional<T>` is the only thing that
// holds one, so there is no null to dereference. Narrowing does the rest:
// past the `||`, `biggest` is a Money.
export pure fn largest(amounts [Money]) -> Optional<Money> {
var biggest Optional<Money> = nil
for amount in amounts {
if biggest == nil || amount > biggest {
biggest = amount
}
}
return biggest
}import { Column, Row, Spacer } from elp.layout
import { Text, Button } from elp.components
import { Money, Item } from .types.item
// A component body runs once, not on every change. Reads subscribe and
// writes patch, so there is no re-render, no dependency array and no memo.
export component Basket(items [Item]) {
export *fn onRemove(item Item)
var expanded = false
// A derived value is an ordinary function. Reading `total()` inside the
// markup is what subscribes this component to `items`.
fn total() -> Money {
var sum = Money.zero()
for item in items {
sum = sum + item.price
}
return sum
}
return Column {
Row {
Text("Basket", variant = .Heading2)
Spacer()
Text(total().toString())
}
if expanded {
// Identity is mandatory on a markup `for`, unlike React's optional
// `key`, so a list that silently loses row state cannot be written.
for item in items by item.id {
Row {
Text(item.name)
Spacer()
Button(onPress = fn { onRemove(item) }) {
Text("Remove")
}
}
}
}
Button(onPress = fn { expanded = !expanded }) {
Text(if expanded { "Hide items" } else { "Show items" })
}
}
}Both are trimmed from the example corpus, which is where the design is tested. The syntax is still being designed, so these will change — the corpus is migrated onto each decision as it lands, and the samples here follow it.
Goals
· 601 · native
Native everywhere
One codebase compiled to a real native binary for iOS, Android, macOS, Windows and Linux, and to HTML, CSS and JavaScript for the web. No web views.
02 · safe
Memory and type safe
Ownership without a garbage collector, errors as values instead of exceptions, and a soundness floor no configuration can turn off.
03 · declarative
UI in the language
Declarative, reactive components in the spirit of SwiftUI and Jetpack Compose, as part of the language rather than a framework on top.
04 · accessible
Accessible by default
The best accessibility standards possible, enforced by the compiler and tooling rather than left to good intentions.
05 · tooled
Batteries included
Package management, testing with coverage, profiling and debugging with LLVM, and supply-chain management, built in.
06 · open
Owned by its community
GPL-licensed, with no corporate owner. Any funding will be public, and the design actively avoids mechanisms that lock anyone in.
Status
Design, not implementation.
There is no compiler yet, on purpose. An early lexer, parser and syntax tree were written in Rust and then removed: a front end built against a design that is still moving is rework, not progress. What exists is the design record, 21 specifications each tested against a corpus of real programs, from an HTTP server and a SQLite binding to a Vulkan triangle and a real-time audio playhead.
Implementation resumes once the design settles. Until then, the most useful thing you can do is read the docs and argue with them.
The design record
· 21Memory and ownership
- Memory model
Ownership with var, const and references, scoped release, Buffer<T>, and how it all lowers to Rust.
- Aliasing
Shared, Confined and Synchronized cells, Copy, Duplicate and Move, and crossing threads safely.
Types
- Generics
Mandatory type arguments, overloading, conditional conformance and variance.
- Interfaces
Method-only, nominal conformance and interface dependencies.
- Dispatch
What an interface in a type position means, and when it is existential or universal.
- Patterns
Destructuring, match, Optional narrowing and the pattern grammar.
Functions and errors
- Functions
The call model, methods and receivers, extension interfaces and C function pointers.
- Operators
Operators as interface methods, precedence, and narrowing through && and ||.
- Control flow
Loops: while, break and continue, why there is no loop and no labels, and what a markup for's by key means.
- Error handling
Errors as Either<T, E> values. No exceptions, no catch.
Modules and the standard library
- Modules
Packages, imports, the prelude, the manifest and native library allow-lists.
- Standard library boundary
What is language, what is a privileged library, and what is plain Elp.
- Collections
Hashing, insertion-ordered Map, the iteration protocol and mutating receivers.
- Strings
UTF-8 strings, char as a scalar value, literals, escapes and why s[i] doesn't exist.
UI and metaprogramming
- Reactivity
Components run once, reads subscribe and writes patch.
- Macros
Macros as pure functions run at compile time over the AST.
Tooling and process
- Diagnostics
Noisy by default, filtered by configuration, with a soundness floor that can't be turned off.
- Core language probes
Real programs, from an HTTP server to a Vulkan triangle, that test the design and log its gaps.
- Grammar notes
Intentional gaps, use-site rules and open questions in the grammar.
- Trade-offs
Where several decisions solve one problem, which decisions cost another program, and the check that would have caught every defect.
- Open questions
One register of every live question, naming the doc that owns it, so nothing is asked in four places at once.
The Elp book
Built from the record.
The design record is already published here, rendered from the language repository at a pinned revision. As the design settles it becomes the Elp book: the same material, reordered for someone learning the language rather than someone deciding it. Until then these documents are the only authority on what Elp is, and they are organised by the question each one answers.
Questions
· 6What is Elp?
Elp is an open-source programming language in design. It aims to let you write an app once and compile it to native code for iOS, Android, macOS, Windows and Linux, and to HTML, CSS and JavaScript for the web.
Can I use Elp yet?
Not yet. Elp is in a design phase and there is no compiler. An early Rust lexer and parser were removed on purpose, because building a compiler against a design that is still changing is rework. Implementation resumes once the design settles.
What does the name mean?
Elp started as Ellipsis. It became 'elp, which is English slang for “help”.
How is Elp different from Flutter or React Native?
Elp aims to compile to a native binary for each platform, instead of drawing its own UI or running JavaScript over a bridge. Its UI model is designed as part of the language, not a framework added on top.
Who makes Elp?
Elp is designed by Dave Mackintosh and sponsored by New World Code Ltd, a UK software company. It is licensed under the GPL-3.0 and is intended to stay community-owned.
How can I get involved?
Read the design docs on GitHub, then open an issue or a pull request. Design discussion is the most useful contribution right now.
Help shape the language.
Fork it, read it, improve it and send a pull request.