DEV Community

Alex Spinov
Alex Spinov

Posted on

Val Language Has a Free API You've Never Heard Of

Val is a research programming language focused on mutable value semantics. Created by researchers at the University of Montreal and Apple, it explores a radical idea: what if we could have the safety of Rust without the complexity of borrow checking?

What Makes Val Different?

Val introduces mutable value semantics — a programming model where:

  • Every value is independent — no shared mutable state by default
  • No garbage collector — deterministic memory management
  • No borrow checker — safety through value semantics, not lifetime annotations
  • Swift interop — designed to work alongside Swift

The Hidden API: Val's Type System

Val's type system exposes powerful compile-time APIs:

// Subscripts — Val's unique API for computed properties
type Matrix {
  var storage: Array<Double>
  let rows: Int
  let cols: Int

  subscript(row: Int, col: Int): Double {
    let {
      storage[row * cols + col]
    }
    inout {
      &storage[row * cols + col]
    }
  }
}
Enter fullscreen mode Exit fullscreen mode

Mutable Value Semantics API

// The inout parameter — Val's key API concept
fun swap<T>(_ a: inout T, _ b: inout T) {
  let tmp = a
  &a = b
  &b = tmp
}

// Method bundles — multiple implementations for one API
type Stack<Element> {
  var storage: Array<Element>

  subscript top(): Element {
    let { storage.last! }
    inout { &storage[storage.count - 1] }
  }
}
Enter fullscreen mode Exit fullscreen mode

Compile-Time Safety

Val catches errors at compile time that other languages miss — no data races, no use-after-free, no null pointer exceptions. All through value semantics rather than ownership tracking.

Quick Start

git clone https://github.com/val-lang/val.git
cd val
swift build -c release
.build/release/valc hello.val -o hello
./hello
Enter fullscreen mode Exit fullscreen mode

Why Researchers Are Excited

A PL researcher shared: "Val solves the fundamental tension in Rust — you get memory safety and mutation, but without lifetime gymnastics. It's what happens when you rethink safety from first principles."


Interested in cutting-edge developer tools? Email me at spinov001@gmail.com or check out my developer toolkit.

What do you think about mutable value semantics? Could Val replace Rust for some use cases?

Top comments (0)