An Introduction to Envzn
What Envzn Is, and What It Isn't
Envzn (pronounced envision) is a modern, fast, and readable systems programming language. It uses an ahead-of-time compiler that produces native code and achieves memory safety without the overhead of a garbage collector. Designed to be intuitive for developers, Envzn is primarily targeted at data science, finance, and systems development.
Envzn includes the essential features expected in a modern programming language:
- A dedicated package manager
- A robust compiler with 670 error and warning codes
- Integration with commonly used IDEs: VS Code, Vim, Emacs, CotEditor, plus a language server (LSP)
- Object-oriented architecture
- An extensive standard library
- Support for generics/templates
- Column-major arrays
Design Influences
The design of Envzn draws inspiration from many industry-standard languages. While it incorporates memory safety similar to Rust, it takes a different approach (discussed below). It also adopts generics like many languages, matrix handling like Fortran, data manipulation like Python, mathematical capabilities similar to Julia, an intermediate representation like Java, and aspires to the versatility of Go.
Core Philosophy
Envzn intentionally avoids common developer pain points, such as pre-processor commands (e.g. #pragma, #define), silent integer wrapping, and steep learning curves.
To eliminate the complexities associated with pointers, Envzn uses stack-based object handles and references. While object creation is explicit with CREATE(), deletion is handled automatically; a destructor runs as soon as a handle falls out of scope. Furthermore, explicit conversion operators are used in place of traditional type casting.
Why Build Another Language?
The concept for Envzn originated in 1995 when language author Brian Haughton met with the original Java team at Sun Microsystems. This meeting inspired the vision for a memory-safe language that operates without garbage collection while remaining readable, modern, world-class, fast, and intuitive.
These six principles became the core tenets of Envzn. After initial design work in 2001, followed by revisions in 2011 and 2018, the language was fully implemented in 2026. Envzn aims to relocate the cost of complexity inward, providing a better experience for both software engineers and end-users. For example, the compiler automatically detects the target platform and emits platform-specific adjustments, freeing the developer from manual configuration.
Terminology
This guide assumes familiarity with basic development concepts (such as libraries and JSON) as well as object-oriented principles. The following terms are specific to Envzn:
- Module: A directory containing related code that compiles into a library or executable. All files in a module are compiled simultaneously to reduce build times.
- EvIR (Envzn Intermediate Representation): The intermediate code generated by the compiler before native code is produced. It is saved as a
modulename.evirfile. - Handle: A stack-based variable for a class or object whose data resides on the heap. Handles can be owned, references, or mutable references.
- Reference: A type of handle that points to an object without taking ownership.
Hello, World, One Line at a Time
MODULE hello // Define the module
// Double-slash for single-line comments
/* C-style for multi-line
comments */
CLASS Main IMPLEMENTS TaskStarter { // TaskStarter is a standard interface
METHOD start() RETURNS STATUS { // start() is where the program begins
printline("hello world") // Print to standard output
RETURN (SUCCESS) // Return success status
}
}
Four Unique Features
- Template Qualifiers: Mandatory, readable type constraints on generics that support multiple types with specific exceptions.
- Either-or Return: Return any type (an object handle or value) or a FAILURE status from a method.
- Cross-Library Memory Safety Checks: Verification of memory safety across external library boundaries.
- Actionable Compiler Errors: Every compiler error points directly to the problem spot, includes a suggested fix, and cites the specific language rule from the Constitution document.
An Overview of the Essentials
You will notice that all keywords are in uppercase, with the exception of primitive types. This is so that all keywords stand out.
Primitives
Envzn has 29 distinct types divided into families:
- Signed Integer:
int8,int16,int32,int64*,int128 - Unsigned Integer:
uint8,uint16,uint32,uint64,uint128 - Float:
float32,float64* - Character:
char8,char16,char32* - boolean: holds
TRUEorFALSE - binary: an uninterpreted octet; a bit pattern, not a number
- number: a self-aware integer-or-float that auto-promotes from
int64touint64tofloat64 - complex: a pair of
numbertypes written with theimliteral —3 + 4im - decimal128: an exact base-10 number with round-half-even arithmetic
- opaque: container for heterogenous storage and typed FOREIGN pointers
- UNSAFE: a family of types that may only be used within an
UNSAFEblock UNSAFE.HANDLE: container for an untyped FOREIGN pointerUNSAFE.MUTEX: raw OS mutex; use the kernelMutexclass insteadUNSAFE.CONDVAR: raw OS condition variable; use the kernelThreadConditionclass instead- C: a family of types for use only with the C ABI:
C.size_t,C.ssize_t,C.long,C.unsignedLong,C.mode_t
* the default for that family, e.g. int is an alias for int64
Class, Struct, and Namespace
- STRUCT: a C-style data structure that only contains data fields; it cannot inherit or implement an interface
- NAMESPACE: a C++-style namespace that only contains functions and constants; it cannot inherit or implement an interface
- CLASS: a combination of data fields, constants, and methods; it may inherit from one other class and implement many interfaces. There are multiple modifiers of CLASS, some are mutually-exclusive:
- Plain: normal class with polymorphic traits
- FINAL: class that cannot be a parent for another class
- VALUE: class that should be treated like a STRUCT
- INTERNAL: class that cannot be seen outside its module
- SINGLETON: class that has only one instance
- SHARED: class that could use the
SHARED MUTABLE REFERENCEhandle - ABSTRACT: class with at least one method declared but not defined
- HIDDEN: class that when instantiated must be assigned to its interface
Native Arrays
Envzn has strong native arrays available on any type in three forms (T[], T[size], T[size+]) for rank 1 with examples below:
int32[]: native array ofint32elements, growable, with starting size=0binary[64]: native array ofbinaryelements, fixed size of 64char32[128+]: native array ofchar32elements, growable with a starting size of 128char32elements (512 bytes)
For rank 2:
int64[,]: native array ofint64elements, type spinefloat64[m,n]: native array offloat64elements, extents defined at run timefloat32[5,8]: native array offloat32elements, fixed size
For rank 3:
int64[,,]: native array ofint64elements, type spinefloat64[j,k,l]: native array offloat64elements, extents defined at run timefloat32[5,8,9]: native array offloat32elements, fixed size
Native arrays work with user defined types also, so class and struct types may also be used in these. Ranks are valid up to 15 dimensions.
Native arrays have a limited set of methods. (If you need more functionality, use the standard library Array class.)
Data Fields
Data fields are internal variables for a CLASS or STRUCT. Plain data fields are public; they may be marked INTERNAL, PROTECTED, or PRIVATE for limiting access. They are immutable by default and may only be changed in a MODIFY method. Example:
CLASS MyClass {
String name // public data field name of type String
INTERNAL int8 age // data field age of type int8;
// INTERNAL means it is only seen inside
// the module of MyClass
}
STATUS
STATUS is an in-built type to have a standard way for returning SUCCESS, FAILURE, or PARTIAL_SUCCESS to the caller. It is used often with the Either-Or Return of methods.
Handles and References
This handle can be assigned to a reference handle, which allows read-only access. For write access, the handle can be assigned to a mutable reference, though only one active mutable reference is permitted at a time. Alternatively, shared mutable references allow multiple references to modify the object for a class declared as SHARED.
Variable Assignments
To assign a value to a variable there are three assignment operators:
=assignment for a primitive or a String constant:=assignment for an owned handle of a class instance or object; moves ownership into the handle on the left hand side of the operator=@assignment forREFERENCEandMUTABLE REFERENCEhandles
Examples:
int32 n = 5
Widget w := CREATE()
REFERENCE Widget rw =@ w
Text Handling
The Envzn standard library has four classes for text and two views to aid in searching those.
String: immutablechar32array (any change creates a new String object)DynamicString: mutablechar32array (changes update the same object)ByteBuffer: immutablebinaryarrayDynamicByteBuffer: mutablebinaryarrayStringView: search and other utility methods forStringByteBufferView: search and other utility methods forByteBuffer
While one may use native arrays for text storage, these 6 classes have a rich API to provide access developers expect in modern development.
Control Flow
Envzn has multiple means for flow control:
IF (conditional-expression) THEN { } ELSE { }: logical branchingWHILE (conditional-expression) DO { }: tests the conditional expression first, then executes the code block repeatedly as long as the conditional expression is TRUEUNTIL (conditional-expression) DO { }: tests the conditional expression first, executes the code block repeatedly as long as the conditional expression is FALSEDO { } WHILE (conditional-expression): executes the code block, repeats while the conditional expression is TRUEDO { } UNTIL (conditional-expression): executes the code block, repeats while the conditional expression is FALSEFOR i=a TO b STEP s { }:iis assumed to beint64FOR (int32 i=0; i<5; i++) { }: C-style loopFOR element IN MyArray { }: requiresMyArrayto have an IteratorLOOP element IN MyArray WITH INDEX i { }: element plus itsint64positionREPEAT n { }: repeat the loop n times; an infinite loop without nLABEL name <loop or block>: a name for a block of codeBREAK/CONTINUE: breaks out of a loop or continues at the startBREAK name/CONTINUE name: breaks out of the named block of code to resume after it; continues at the start of the named block of code; very useful in nested loops
Method Parameters and MODIFY
Methods accept zero or more inbound arguments and may return multiple results. Any method that modifies an object's internal data fields must be explicitly declared with MODIFY. Read-only references cannot invoke modifying methods.
When plain handles are passed as arguments, ownership is transferred ("moved") into the method. Reference handles, however, do not transfer ownership. Primitive values and structs are always copied. Examples:
Widget w := CREATE() // Create a Widget; w is the owning handle
REFERENCE Widget rw =@ w // Assign a read-only reference
MUTABLE REFERENCE Widget mrw =@ w // Assign a mutable reference
METHOD foo(REFERENCE Widget myref) { // pass in object handle 'w'
myref->doSomething() // the myref handle is read-only so
// doSomething() cannot modify myref
}
Generics / Templates
Envzn allows generic types, and they are used extensively. Many types that developers expect in a modern language, such as Array[T], Dictionary[K,V,H], LinkedList[T], Set[T], and Queue[T], are found in the standard library. These have a rich API and describe the types that are allowed to be used with them. Each generic class has a "template qualifier" preamble prior to the class definition to constrain what types may be used by that class. An example:
TEMPLATE: GIVEN TYPE T IS Cloneable, PRIMITIVE (EXCEPT opaque, boolean):
CLASS Array[T] IMPLEMENTS Cloneable, Collection OF T, Shuffleable OF T {
…
}
In this example, generic type T is constrained to something that implements the Cloneable interface, or be a primitive (like int32) but it cannot be opaque or boolean types.
A Note on Memory Safety
To achieve memory safety, Envzn aims to address eight main challenges:
- Escaping and dangling references: a reference outlives its origin object
- Use after move: an owning handle is read after ownership left
- Reference held after a mutation: the origin object is modified while a
REFERENCEto the origin object is held by another - Memory leaks: a strong reference cycle is never torn down
- Null or uninitialized memory: a slot is read before it is assigned, or after it has been reset to null
- Data races: concurrent access issues
- Spatial bounds: access out-of-bounds of an array
- Stack exhaustion: overflowing the stack, caused by deep recursion or dropping a long owned chain
The compiler today covers 7 of the 8 challenges: the only one that has not been built and tested thoroughly is #6, data races. Challenges #5, #7, and #8 are checked at runtime, while #2 and #4 are checked at compile time. For memory safety coverage of #1 and #3, the compiler generates an EvIR file for libraries, and at compile time, walks through code that has passed the analysis rules engine to track the lifecycle of every handle and reference from initial assignment to its end. By analyzing both the current program and the EvIR files of used libraries, Envzn works to ensure complete memory safety with minimal impact on compilation time.
Where to Go From Here
- Features of Envzn: the language one feature at a time
- The User Guide: the language, chapter by chapter
- The standard library: every kernel type, with its methods
- Diagnostics: every error and warning, with how to fix it
- The Constitution: the specification, which wins any disagreement