Alloy
Alloy is (or rather was supposed to be) a language that fuses Rust's power, safety guarantees, and performance with Swift's ergonomics and TypeScript's type system innovations. It features unique systems like explicit effect tracking and an advanced trait system with defaults. It maintains portability and compatibility by transpiling to Rust code, meaning it runs pretty much anywhere Rust does, and can take advantage of the existing Rust ecosystem. Unfortunately the project was never finished. I include this specifically because it includes some of the best Rust I've ever written that can be open-sourced.
〉git clone https://github.com/v01dlabs/alloy.git
Project Details
When we stopped, we had implemented a first pass at the lexer, parser, and transpiler. The initial goal was to get something which could turn the simplest nontrivial Alloy programs into equivalent Rust code. We were working on type checking and inference, and had made good progress. This was all done over the course of about two weeks in October 2024. My friend and I had to put it down to work on other things, then she moved on and I haven't had the time or the heart to pick it back up again.
Main Design Components
  • Performance: (hopefully) Zero-cost abstractions and efficient compilation to Rust
  • More expressive type inference (from Swift and TypeScript)
  • Optional chaining and null coalescing operators (from Swift)
  • Union types and type narrowing (from TypeScript)
  • Explicit side effect tracking
  • Traits with swappable defaults
  • Trailing closures and Guards (from Swift)

effect IO {
  read_line() -> String
  print(String)
}

fn process(input: String) -> String {
  input
   |> trim()
   |> to_uppercase()
   |> add_exclamation()
}

fn main() -> Result[(), Error] with IO {
  print("Enter your name: ")
  let name = read_line()
  let processed = process(name)
  print("Hello, {processed}!")
  Ok(())
}