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.

// Simple, clean function definitions
fn double(n: int) -> int = n * 2

// String interpolation that works
let x = 42
let name = "Alice"
print("x = ${x}")
print("name = ${name}")

// Pattern matching on values
let result = match x {
  42 => "The answer!"
  0 => "Zero"
  _ => "Something else"
}
print("Result: ${result}")

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.

// Fiber Example
fn compute(value: int) -> int = value * 2

// Each fiber runs independently  
let fiber1 = spawn compute(5)
let fiber2 = spawn compute(10)

print("Fiber 1 result: ${fiber1}")  
print("Fiber 2 result: ${fiber2}")

// Background processing with yield
let job1 = yield 10
print("Processed ${job1} items")

print("=== Fiber Example Complete ===")

Pattern Matching

Exhaustive pattern matching ensures all cases are handled at compile time. No forgotten branches, no runtime surprises.

fn analyzeNumber(n: int) -> string = match n {
    0 => "Zero"
    1 => "One" 
    42 => "The answer to everything!"
    _ => "Some other number"
}

fn getCategory(score: int) -> string = match score {
    100 => "Perfect!"
    95 => "Excellent"
    75 => "Good"
    _ => "Needs Improvement"
}

print("Number analysis:")
print("42 is ${analyzeNumber(42)}")
print("Score 95: ${getCategory(95)}")

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.

Build It With Us

AI assistants have democratized compiler development. If you can build apps with Claude or Cursor, you can help build Osprey.