The Vision

Osprey was born from the belief that elegance is the best defence against bugs. Too many hours are wasted debugging null pointer exceptions, handling unexpected panics, and tracking down race conditions. Osprey is different.

Osprey's type system aims to prevent entire classes of bugs at compile time, make concurrency safe by default, and keep your code maintainable for years to come.

type User = {
  email: String where isValidEmail(email),
  age: Int where between(age, 0, 150)
}

// Result type ensures error handling
let user = User {
  email: "alice@example.com",
  age: 25
}

match user {
  Ok { value } => welcomeUser(value),
  Err { error } => showValidationError(error)
}

Design Principles

🎯 Simplicity First

One way to accomplish any task. No multiple syntax variations, minimal ceremony.

  • Single approach for each language feature
  • Named arguments for clarity
  • Self-documenting code

🛡️ Safety by Design

Type system prevents bugs at compile time. No null pointers, buffer overflows, or data races.

  • Result types for all error conditions
  • Memory safety without garbage collection
  • Compile-time race condition prevention

⚡ Fiber Concurrency

Isolated module instances per fiber eliminate data races. Scale to millions of concurrent tasks.

  • Zero-cost fiber creation
  • No shared mutable state
  • Typed channels for communication

🔗 Rust Interoperability

Seamless integration with Rust for maximum performance. Type-safe FFI.

  • Direct Rust async/await integration
  • Zero-overhead interop
  • Gradual migration support

Core Philosophy

Referential Transparency

Functions return the same output for the same input. Side effects are explicit.

Immutability by Default

Data immutable unless explicitly marked mutable. Safe sharing across fibers.

Explicit Error Handling

No exceptions or panics. All failures return Result types.

Zero-Cost Abstractions

High-level features compile to optimal machine code.

Key Differences

Feature Traditional Osprey
Error Handling Exceptions, panics Result types
Null Safety Null pointer exceptions Option types only
Concurrency Shared mutable state Fiber-isolated modules
Type Safety Runtime type errors possible Compile-time prevention of type errors
Memory Management Manual memory or garbage collection Memory safety with automatic reference counting

Key Innovations

Fiber-Isolated Modules

Revolutionary approach to concurrency where each fiber gets its own isolated instances of modules. Eliminates data races while maintaining clean encapsulation.

module Counter {
  let mut count = 0
  fn increment() = { count = count + 1; count }
}

// Each fiber has its own Counter instance
let fiber1 = Fiber { 
  computation: fn() => Counter.increment() 
}
let fiber2 = Fiber { 
  computation: fn() => Counter.increment() 
}

// Both return 1, not 1 and 2
await(fiber1)  // 1
await(fiber2)  // 1 (separate instance)

Constraint-Based Types

Type constructors with WHERE constraints ensure data validity at creation time. Invalid data simply cannot exist in your program.

type Person = {
  name: String where notEmpty(name),
  age: Int where between(age, 0, 150),
  email: String where validateEmail(email)
}

// Returns Result
let person = Person { 
  name: "Alice", 
  age: 25, 
  email: "alice@example.com" 
}

Safe Arithmetic by Default

All arithmetic operations return Result types to handle overflow, underflow, and division by zero. Math errors are impossible to ignore.

// Safe division that cannot panic
fn divide(a: Int, b: Int) -> Result = 
  match b {
    0 => Err { error: DivisionByZero }
    _ => Ok { value: a / b }
  }

// Must handle the result
match divide(a: 10, b: 0) {
  Ok { value } => print("Result: ${value}")
  Err { error } => print("Cannot divide by zero")
}

The Future

We are just getting started. We're building a complete ecosystem for safe, concurrent programming.

🔗

Haskell Integration

Future interoperability with Haskell for formal verification and mathematical proofs of program correctness.

📦

Package Ecosystem

Growing library ecosystem with built-in safety guarantees and comprehensive documentation.

🛠️

Development Tooling

Advanced IDE support, intelligent debuggers, and powerful development tools for productive programming.

🎓

Education & Learning

Comprehensive resources to teach safe programming principles and functional programming concepts.

Join the Revolution

Help us build the future of programming. Safe, fast, and elegant code for everyone.