Preface
Code was never natural to us. We naturalised it. Every programming language in existence is a compromise between what humans can read and what machines can execute — and for seventy years the compromise has favoured the humans. Keywords are English words. Operators are symbols from algebra. The machine has been asked to understand us.
That compromise is ending. The rise of large language models has produced a species of machine that can hold far more context than any human, reason across wider conceptual distances, and generate code faster than we can review it. Asking such a machine to keep speaking Python is like asking a concert pianist to communicate in semaphore.
New Code is a proposal for the other direction. A language whose primary reader is an AI system, whose primary writer is an AI compiling from human intent, and whose source text is optimised for machine interpretation rather than human legibility.
The language draws its primitive objects from Waveform Logic — a mathematical system in which numbers are oscillatory structures carrying frequency, amplitude, phase, and shape. Its execution model comes from Processism, the philosophical framework in which stasis is incoherent and process is fundamental.
1. Design Principles
New Code rests on six principles, stated in order of priority. When two conflict, the earlier one wins.
| # | Principle | What it means in practice |
|---|---|---|
| 01 | Process over state | A variable does not have a value — it is a process whose current realisation can be sampled. Stasis is not a legal state. |
| 02 | Structure over scalar | Every value carries ⟨f, A, φ, σ⟩. Collapsing to a scalar is legal but destructive and opt-in. |
| 03 | Intent as first-class | Every function carries intent, forbid, and ensure clauses. These are part of the type system — the compiler must satisfy them or fail. |
| 04 | The compiler is the reader | Syntax is chosen for machine parsing, not typographic beauty. Identifiers are long. Operators are non-ASCII where ambiguity would cost. |
| 05 | Entanglement over dependency | When two values must stay consistent, the language says so. Propagation is automatic through the coupling function Φ. Non-transitive by construction. |
| 06 | Collapse is explicit, lossy | Any reduction to a scalar uses ⌊·⌉ and declares what is lost. Information loss is visible in the signature. |
2. The Execution Model
A New Code program is a directed graph of processes. Execution is not the sequential evaluation of statements but the continuous unfolding of the graph.
Processes, not threads
A process in New Code is not a thread in the OS sense. It is the language's primitive unit of ongoing computation. A process has four components mirroring 𝕎: frequency (how often it produces output), amplitude (magnitude of output), phase (offset relative to a reference), and shape (functional form over time).
The unfolding
A New Code program does not run. It unfolds. The runtime unfolds the graph by allowing each process to advance along its own internal time. A New Code debugger does not step through instructions — it inspects the current realisation of a chosen process and optionally drifts it to examine nearby trajectories.
No implicit global time
New Code has no global clock. Each process carries its own τ parameter. When two processes must be coordinated, coordination is expressed as entanglement. This eliminates a large class of race conditions but introduces desynchronisation (phases drifting apart under independent evolution).
Termination
A program terminates when every process has either (a) reached a declared fixed point, (b) been collapsed and consumed, or (c) drifted to the square-wave attractor sq — called thermodynamic termination. Without external input, every process dies to the same shape.
3. Primitive Types
| Type | Name | Definition |
|---|---|---|
| 𝕎 | Waveform number | A quadruple ⟨f, A, φ, σ⟩ of frequency, amplitude, phase, and shape. The fundamental value type. |
| 𝕎* | Spectrum | A finite superposition of waveform numbers, written with ⊕. Represents complex signals. |
| shape | Shape | A unit-periodic function σ : ℝ → [−1, 1]. Built-in: sine, square, triangle, sawtooth, pulse(d), noise(seed). |
| ℝ | Scalar | A conventional real number. A degenerate case of 𝕎. Can only be produced from 𝕎 through collapse. |
| proc<τ> | Process | A running computation that produces values of type τ. The type parameter is mandatory. |
| ⟨τ₁ ▷◁ τ₂⟩ | Entangled pair | A pair of values coupled by a declared Φ function. Components cannot be updated independently. |
| ⌊τ⌉ | Collapsed | A wrapper type marking a value reduced from its full structural form. Visible in function signatures. |
| stream<τ> | Stream | A lazy, potentially infinite sequence of τ values. |
| fault<name> | Fault | A structured failure value with a named type and payload. Not an exception — it's part of the return type. |
Example declarations
let carrier : 𝕎 = ⟨ 440.0, 1.0, 0.0, sine ⟩
let chord : 𝕎* = ⟨440, 0.82, 0, σ_f⟩ ⊕ ⟨880, 0.34, 0, σ_2nd⟩
let beat : proc<𝕎> = every ⟨1.0, 1.0, 0, pulse(0.1)⟩
4. Syntax
New Code's syntax is designed for unambiguous machine parsing. It is not pleasant to type. It is not meant to be — the compiler generates it from intent.
Declaration forms
※ Variable binding
let NAME : TYPE = EXPRESSION
※ Process declaration
process NAME : TYPE ≔ EXPRESSION
※ Function with intent
fn NAME (ARG : TYPE, ...) → RETURN_TYPE
intent: 「what this function is for」
forbid: 「what it must not do」
ensure: 「invariant it must maintain」
≔ EXPRESSION
The ≔ symbol means "is defined as". A ≔ ?? is a hole — the compiler fills it from the intent declaration. intent, forbid, and ensure are mandatory for any function exposed outside its module. Private functions (prefixed _) may omit them.
String literals
Strings are bracketed with 「 and 」. They are primarily used in intent declarations and tags, not as a primary data type.
Comments
※ begins a line comment. Block comments use 《 ... 》.
5. Operators
| Symbol | Name | Properties | Notes |
|---|---|---|---|
| ⊕ | Superposition | Commutative, associative | The addition of New Code. Identity: zero-amplitude waveform. |
| ⊚ | Oscillation product | Commutative, not associative | Chains of ≥ 3 require explicit parentheses — compiler warns otherwise. |
| ⁻ | Phase inversion | Unary postfix | Shifts phase by π. Provides additive inverse under ⊕. |
| ⇝ | Drift | Infix · a ⇝ δ | Shifts f, decays A, rotates φ, deforms σ toward sq. δ=0 is identity. |
| ⟪·,·⟫ | Coherence | Binary bracket → ℝ | Returns shape-sensitive correlation in [−1, 1]. This is a collapse. |
| d_γ | Coherence distance | Binary → ℝ | Non-Euclidean distance on 𝕎. Sensitive to shape. |
| ▷◁ | Entanglement | Declarative | Used in type signatures and the entangle primitive. |
| ◈ | Re-coherence | Unary | Restores phase alignment of two drifted processes. Expensive, may fail. |
| ‖ | Synchronisation | Binary | Forces two processes to advance in lockstep for the duration of a block. |
| ⌊·⌉ | Collapse | Unary bracket → ℝ | Reduces 𝕎 to amplitude-weighted coherence with e₀. Irreversible, lossy. |
| ▶ | Series composition | Process combinator | Feeds output of one process into input of next. |
| ∥ | Parallel composition | Process combinator | Runs two processes independently, yielding a pair. |
| ↺ | Feedback | Process combinator | Feeds a process's output back into itself with declared delay. |
Operator precedence (tightest → loosest)
- Unary postfix:
⁻,?(sample) - Bracket operators:
⌊·⌉,⟪·,·⟫ - Oscillation product:
⊚ - Drift:
⇝ - Superposition:
⊕ - Synchronisation:
‖ - Entanglement declaration:
▷◁
6. Control Flow
New Code has limited control flow. Most of what conventional languages do with branching is expressed through process composition.
Conditional: when
let response : 𝕎 = when signal_strength > threshold
then amplified_signal
else silence
when is an expression, not a statement. Both branches must have the same type. A when without an else is a type error.
Pattern matching: case
case incoming of
⟨f, _, _, sine⟩ when f < 100 ↦ handle_sub_bass(incoming)
⟨f, A, _, _⟩ when A < 0.01 ↦ noise_floor()
⟨_, _, _, σ⟩ ↦ generic_processor(σ, incoming)
The compiler verifies exhaustiveness. Non-exhaustive cases are a compile error, not a warning.
Iteration: fold
let combined : 𝕎* = voices fold with ⊕ from silence
New Code has no for or while loop. Iteration over finite structure is expressed as a fold.
7. Functions and Processes
Pure functions
A function declared with fn is pure: given the same input, it returns the same output. Purity is enforced — attempting to read external state from within a fn is a compile error.
Processes
A process is introduced with process and is permitted to have internal state, external effects, and ongoing unfolding. The cost is that a process must declare its interaction interface explicitly through emits and consumes clauses.
process audio_in : proc<𝕎>
intent: 「continuously sample microphone input as waveform」
emits: 𝕎 at 48000 Hz
consumes: hardware_channel<mic>
≔ ...
Higher-order functions
Functions may accept and return other functions. Higher-order functions must declare constraints on the intents of their function arguments using requires clauses:
fn apply_to_signal (f : fn(𝕎) → 𝕎, w : 𝕎) → 𝕎
intent: 「apply a shape-preserving transformation f to w」
requires: f.ensure contains 「preserves shape」
≔ f(w)
8. The Intent Layer
The intent layer is what distinguishes New Code from every language preceding it. It is where humans, in practice, actually write.
Intent declarations are part of the function's type. Two functions with identical input/output types but different intents are different types. You cannot pass a function whose intent is "compress audio dynamically" where a function whose intent is "apply a shape-preserving transformation" is required, even if the raw types match.
The hole
fn classify (sample : 𝕎, known : [signature]) → signature | fault<no_match>
intent: 「identify the instrument whose prototype has smallest coherence distance」
forbid: 「return a match if the best distance exceeds the ambiguity threshold 0.65」
ensure: 「output is the unique nearest signature, or a no-match fault」
≔ ??
The ≔ ?? is a hole. The compiler fills it. If the compiler can produce an implementation that satisfies all three declarations, it does so. If it cannot, it reports which intent it cannot satisfy and asks you to refine.
Intent inheritance
Modules declare their own intent clauses, which propagate to all contained functions as a constraint. A function whose local intent contradicts the containing module's intent is a compile error. This enforces architectural coherence at the language level.
9. Entanglement and Coupled State
Two values in New Code are entangled when there exists a declared coupling function Φ such that any transformation of one induces Φ on the other.
let stereo_field : ⟨𝕎 ▷◁ 𝕎⟩ = entangle(L, R) via φ_haas
※ Transforming one side propagates through Φ automatically
let new_pair = amplify(stereo_field.left, 2.0)
※ Disentangle to work on sides independently (lossy)
let ⟨L, R⟩ = disentangle(stereo_field)
Key properties
- Symmetric — both sides propagate to each other
- Not transitive — A ▷◁ B and B ▷◁ C does not imply A ▷◁ C
- Runtime-enforced — not a convention, not a test, not a hope
10. Drift, Decay, and Temporal Semantics
The drift operator
Drift (⇝) takes a process and a scalar δ and returns a process advanced by δ units along the drift trajectory. This is distinct from waiting δ units of wall-clock time. Drift simultaneously:
- Shifts frequency by δA (amplitude-modulated)
- Decays amplitude by
exp(−|δ|) - Rotates phase by δf
- Deforms shape toward the square-wave attractor by |δ|
A process drifted by δ = 0 is unchanged. A process drifted by a large δ converges toward sq — the terminal configuration of all oscillation.
Three uses of drift
| Use | Description |
|---|---|
| Ageing | Applying ⇝ over time simulates gradual signal degradation. Used wherever temporal realism matters. |
| Analysis | The δ at which two processes become indistinguishable under coherence distance is the identifiability horizon — useful in classification. |
| Thermodynamic termination | A process not externally sustained drifts toward sq. Terminating cleanly means letting this happen naturally. |
11. Collapse and the Interface to Conventional Systems
New Code must interoperate with conventional systems that expect scalars. The collapse operator is the bridge.
※ The collapse operation
⌊ ⟨f, A, φ, σ⟩ ⌉ = A · γ(⟨f, A, φ, σ⟩, e₀)
※ A function that collapses marks its return type
fn peak_detector (w : 𝕎) → ⌊ℝ⌉
intent: 「identify the peak amplitude of w as a scalar」
forbid: 「claim to preserve structure」
ensure: 「output is A of input」
≔ ⌊w⌉
※ Callers pattern-match on the collapse marker
let ⌊peak⌉ = peak_detector(signal)
12. Modules and Composition
module audio.analysis
intent: 「provide primitives for analysis of incoming audio streams」
forbid: 「produce outputs claiming precision beyond numerical floor of input」
ensure: 「all exported functions are shape-preserving or explicitly marked collapsing」
export fn spectral_centroid ...
export fn onset_detection ...
Every module carries an intent block. Functions whose local intent contradicts the module's intent are compile errors — architectural coherence is enforced at the language level, not the conventions level.
13. Error Model
New Code has no exception mechanism. A function that may fail declares its failure modes in its return type as a sum type.
fn parse_frequency (source : ⌊string⌉) → 𝕎 | fault<parse>
intent: 「parse a textual frequency specification into a waveform number」
forbid: 「produce silent defaults on malformed input」
ensure: 「failure cases are explicit」
≔ ...
※ Callers must handle both branches
case parse_frequency(「four forty」) of
⟨f, _, _, _⟩ ↦ use_it(f)
fault<parse>(location, payload) ↦ diagnose(location, payload)
Faults are structured values with a type, a location, and a payload. Thermodynamic termination (drifting to sq) is not a fault.
14. Worked Example: Timbre Classification
This example implements timbre classification — given a recorded instrument sample, identify which instrument it is. Coherence distance does the heavy lifting; shape information is preserved throughout.
module audio.timbre
intent: 「classify musical instruments by timbre, independent of pitch」
forbid: 「rely on features that collapse shape information before comparison」
ensure: 「classifications are stable under drift up to the declared identifiability horizon」
import waveform.algebra.{⊚, ⟪·,·⟫, d_γ, ⇝}
import audio.capture.mic_input
record signature ≔ { name : ⌊string⌉, prototype : 𝕎 }
fn classify (sample : 𝕎, known : [signature]) → signature | fault<no_match>
intent: 「identify the instrument whose prototype has smallest coherence distance to sample」
forbid: 「return a match if the best distance exceeds the ambiguity threshold 0.65」
ensure: 「output is the unique nearest signature, or a no-match fault」
≔ ??
export classify, fingerprint, identifiability_horizon
A human who cared only about the intent could write exactly that ≔ ??. The compiler produces an implementation equivalent to the full body — distances computed, threshold enforced, nearest signature returned.
15. Use Cases
New Code is not a general-purpose replacement for Python or Rust. It is a language for specific domains where its primitive commitments produce real advantages.
| Domain | Why New Code fits |
|---|---|
| Audio and signal processing | The native representation is a waveform. All operations preserve phase and shape by default. |
| Continuous-simulation modelling | Entanglement handles consistency requirements; drift handles gradual parameter evolution. |
| AI-AI interface code | The intent layer makes machine-to-machine interfaces verifiable. One AI declares what its code does; the consuming AI checks the declaration. |
| Specification-first codebases | Financial settlement, medical firmware, legal contract execution — places where "code matches spec" should be a guarantee, not a hope. |
| Experimental language design | The drift operator and entanglement primitive have no analogue elsewhere. A concrete object to build on and argue about. |
New Code is explicitly not well suited to: low-level systems programming where every cycle counts, scripting and one-liners, or any task where intent declarations would drown out the work.
16. Relation to Existing Languages
New Code is not invented from nothing. It draws from:
- ML family (OCaml, Haskell, Rust) — algebraic data types, sum types for errors, pure functions as default
- Dataflow languages (Lucid, Esterel, Max/MSP) — programs as networks of continuously-running nodes
- Dependently-typed languages (Idris, Agda) — types that carry propositions, compiler-verified propositional content
- Prolog / logic programming — the compiler-fills-the-hole pattern (
≔ ??) with a neural compiler in place of a resolution engine - Literate programming (Knuth's WEB) — documentation, specification, and code as a single artefact
What is new is the combination: waveform numbers as primitive, entanglement as a type-level primitive, intent declarations as part of the function signature, verified by a neural compiler.
17. Open Problems
| Problem | Current state |
|---|---|
| Verification of intent | For formal invariants, reduces to existing program-verification techniques. For natural-language intents, the state of the art is a plausibility judgement. Turning plausibility into guarantee is the core technical challenge. |
| The cost of collapse | Every operation on 𝕎 is more expensive than on ℝ. Compilers will need to elide structure when downstream code proves it won't be used. |
| Drift in distributed systems | When processes run on different machines, whose drift is it? The right answer requires a theory of distributed drift that doesn't yet exist. |
| Interoperability | The FFI layer is a sketch. Real interoperability requires boundary types, marshalling rules, and a story about calling New Code from short-lived C functions. |
| Tooling | A debugger, profiler, and package manager for a language where execution is unfolding rather than stepping. Each has to be rethought from scratch. |
| Human review | If the compiler produces the body, how does the human validate it? Machine-assisted review tools that render the generated code in human-friendly form are essential and don't exist yet. |
18. Glossary
Operators and Symbols
| Symbol | Name | One-line definition |
|---|---|---|
| ⊕ | Superposition | Pointwise sum of waveform realisations. Commutative, associative. |
| ⊚ | Oscillation product | Shape-composing multiplication. Commutative, not associative. |
| ⁻ | Phase inversion | Shifts phase by π. Additive inverse under superposition. |
| ⇝ | Drift | Ages a process toward the square-wave attractor by scalar δ. |
| ⟪·,·⟫ | Coherence | Shape-sensitive correlation in [−1, 1]. Marks a collapse. |
| d_γ | Coherence distance | Non-Euclidean distance on 𝕎 derived from coherence. |
| ▷◁ | Entanglement | Type-level coupling by a named Φ function. Symmetric, not transitive. |
| ◈ | Re-coherence | Restores phase alignment between drifted processes. May fail. |
| ‖ | Synchronisation | Forces two processes to advance in lockstep. |
| ⌊·⌉ | Collapse | Reduces 𝕎 to scalar via amplitude-weighted coherence with e₀. |
| ▶ | Series composition | Feeds one process's output into the next. |
| ∥ | Parallel composition | Runs two processes independently, yielding a pair. |
| ↺ | Feedback | Feeds a process's output back into its own input. |
| ≔ | Defines | Separates a declaration header from its body. |
| ?? | Hole | Placeholder body to be filled by the compiler from intent. |
| ※ | Line comment | Comment runs to end of line. |
| 「...」 | String literal | Used in intent declarations and tags. |
| ⟨...⟩ | Waveform literal | Delimits the four components ⟨f, A, φ, σ⟩. |