envzn
0.8 · beta · not released

A readable systems language

readable. intuitive. fast. memory-safe. modern. world-class.

our aspirational goals, and the test every design decision must pass

Get started

Download · available when the public GitHub repository opens

Envzn is an ahead-of-time compiled, statically typed, object-oriented language. It is memory-safe without a garbage collector, and the compiler checks that across the whole program.

Not released. Version 0.8 is a beta with known defects, and there is nothing to download yet. Builds on macOS and Linux. All of it is open source under the MIT license.

METHOD run(REFERENCE String inputPath, REFERENCE String outputPath) RETURNS STATUS {
    Data::CsvSource source := CREATE Data::CsvSource(inputPath)
    IF source->read() THEN {
        Data::DataFrame rawData := $RETURNED
        Data::DataFrame cleaned := rawData->normalizeHeaders()->dropDuplicateColumns()->dropEmptyColumns()
        Data::CsvSink sink := CREATE Data::CsvSink(outputPath)
        RETURN (sink->write(cleaned))
    }
    RETURN (FAILURE("cleanup: read failed"))
}
noteRead a CSV file, clean it and write it back, with the Data module.
/// The byte at `i` within the window, or FAILURE when `i` is outside it.
METHOD at(int64 i) RETURNS (binary value | STATUS status) {
    IF (i < 0) OR (i >= .span) THEN {
        status = FAILURE("BinaryWord.at: index out of range")
        RETURN (status)
    }
    value = .source[.start + i]
    RETURN (value)
}

IF word->at(3) THEN {
    binary b = $RETURNED
    printline("got a byte")
}
ELSE {
    printline("index was out of range")
}
TEMPLATE: GIVEN TYPE T IS Equatable[T]:
CLASS Pair[T] {
    PRIVATE T first
    PRIVATE T second

    METHOD same() RETURNS boolean {
        RETURN (.first->equals(.second))
    }
}
noteThe TEMPLATE line says what T must be. Every use of Pair is checked against it at compile time.

Six goals, and where each stands

These are the goals the design is built toward. Memory-safe, fast and world-class stay aspirational until they are proven; beside each goal is code that shows where the design stands today.

Memory-safe

aspirationalthe floor

No garbage collector. Ownership is checked across the whole program at compile time, so reading a variable after its object has moved away is a compile error.

DynamicString draft := CREATE()
DynamicString kept := draft   // moved
printline(draft->toString())  // error
compilerE3010 Variable accessed after being consumed (line 3)

Readable

Keywords are uppercase words, so the structure of a file reads apart from its names. A program is a class that starts a task and returns a status.

METHOD start() RETURNS STATUS {
    printline("Hello, world!")
    RETURN (SUCCESS)
}

The readability white paper →

Modern

A method can return a value or a status, and the signature says which. Generic code can branch on what a type implements, decided at compile time.

WHEN K IMPLEMENTS Equatable[K] {
    RETURN (.key->equals(other))
} ELSE {
    RETURN (.key == other)
}

Intuitive

A call that can fail is tested where it is made. The failing arm is not optional to write, and $RETURNED is the value the success carried.

IF word->at(3) THEN {
    binary b = $RETURNED
}
ELSE {
    printline("index was out of range")
}

Fast

aspirational

The standard library is written in Envzn. This method is from the dictionary family, and the string-keyed dictionary is competitive on the word dictionary benchmark.

IF NOT (.cachedHash == h) THEN {
    RETURN (FALSE)
}

World-class

aspirational

This is the target, and we will measure it in the open: Envzn scored against 20 other languages on a rubric we publish, weak scores included.

Built for the next decade of code

Defaults chosen for the needs of tomorrow. All 15 differences, with examples → · Features of Envzn →

Types

int is 64-bit.

The friendly name holds any length or index; narrower widths are asked for by name.

int count = list->length()
Text

Text is Unicode code points.

String stores char32, so one character is one element; raw bytes are a separate type, ByteBuffer.

char32 c = name[0]
Arithmetic

Overflow panics, always.

Fixed-width arithmetic that overflows raises MathError in debug and release; wrapping is its own operator.

total &+ step   // explicit wrap
Absence

No null.

Absence is EMPTY, a state the compiler tracks to the point of use.

IF conn IS VALID THEN { … }
Mutation

Read-only unless marked.

Methods cannot change their object unless declared MODIFY.

MODIFY METHOD append(T value) RETURNS STATUS
Ownership

Ownership you can see.

:= moves an object, = assigns a value; a moved-from object handle cannot be read again.

Path p := CREATE("notes.txt")
Arrays

Column-major N-D arrays.

Matrices lay out like Fortran and Julia, so numeric code ports without transposes.

float64[3,3] m
Numbers

Exact decimal as a primitive.

decimal128 is IEEE 754 base-10, so 19.99 stays 19.99.

decimal128 price = 19.99

Start here

Four steps, in order. Each step links straight into the guides, the library and the Constitution, so you can stop when you have what you came for.

Ready to write code

Once 0.8 is public and installed on macOS or Linux, five steps take you from an empty folder to a running program.

  1. Set up your editor.

    Syntax files for VS Code, Vim/Neovim, Emacs and CotEditor ship in editors/, generated from the compiler so they never drift.

    editors/install.sh
  2. Create your first module.

    epm new makes a folder with the standard layout: src/, tests/, docs/, a manifest and a first class, src/Main.ev.

    epm new hello
  3. Write hello world yourself.

    Open src/Main.ev, which epm new wrote for you. Its Main class implements TaskStarter with a start method; change start so it prints Hello, world! and returns SUCCESS.

  4. Build and run it.

    epm build compiles the module into build/; it does not run it.

    cd hello && epm build && build/hello
  5. Write a test.

    Tests use the evTest framework and live in tests/, a module of their own. epm new wrote a first one that passes.

    epm build test && tests/build/helloTest

The library ships with the language

214 types in ten families, written in Envzn and documented from their own source. Every program gets them with no dependency to declare.

ModulesNetworkingJsonRegexDataSQLiteLoggerevTestmoney→quantAdvancedMath→stats→mlearn

Reference shelf

Guides teach. References list. The Constitution is the normative spec and wins any disagreement.

Learn informative

Look up informative

Specify normative

Frequently Asked Questions (FAQ)

Can I use it today?

Not for production: the repository is private, nothing is downloadable, the compiler is a beta with known defects, and it builds on macOS and Linux only.

Release status →

Is it really memory-safe?

Ownership is checked across the whole program at compile time, with no garbage collector, and a program the compiler cannot prove safe does not build.

Memory Safety white paper →

Is it fast?

It aims to be: the standard library is written in Envzn, and we will publish where each benchmark stands against the fastest language, the ones that trail included.

Why does it compile through C++?

C++ gets Envzn onto every platform clang reaches today, and an LLVM backend is designed to replace it.

Compiler architecture →

What is weakest?

Tooling, ecosystem and maturity, because there is no public release yet.

How is it different from Rust‡ or Swift†?

It aims for their safety with a surface that reads like prose, and it relocates complexity into the compiler instead of onto you.

What Makes Envzn Different →

† Manages memory at run time with automatic reference counting; Envzn checks ownership at compile time. ‡ Checks ownership and borrowing at compile time, as Envzn does.