Skip to content

Appendix C: Comparison with Other Languages

Why This Matters

You probably know another language. Understanding how Wyn compares helps you learn faster and make informed decisions about when to use it.

This isn't about which language is "better." Each makes different tradeoffs. Know the tradeoffs, choose appropriately.

Wyn vs Python

Similarities

  • Everything is an object with methods
  • Clean, readable syntax
  • Type inference (you rarely write types)
  • Easy to learn

Differences

Performance:

  • Python: Interpreted, slow (10-100x slower than C)
  • Wyn: Compiled to native code - measured ~1.5-1.7x of C on recursive integer benchmarks (fib), 10x+ faster than CPython on the same code; string-heavy workloads currently land closer to Python than to C (RC + allocation overhead). See benchmarks/ in the compiler repo to reproduce.

Type System:

  • Python: Dynamic, runtime type errors
  • Wyn: Static, compile-time type checking

Memory Management:

  • Python: Garbage collection (pauses, unpredictable)
  • Wyn: ARC (deterministic, no pauses)

Concurrency:

  • Python: GIL limits parallelism, threads don't scale
  • Wyn: True parallelism with spawn, scales to all cores

Code Comparison

Python:

python
def process_files(paths):
    results = []
    for path in paths:
        with open(path) as f:
            content = f.read()
            results.append(len(content))
    return results

Wyn:

wyn
fn process_files(paths: [string]) -> [int] {
    var results: [int] = []
    for path in paths {
        var content = File.read(path)
        results.push(content.len())
    }
    return results
}

When to Use Python

  • Rapid prototyping
  • Data science / ML (ecosystem)
  • Scripts and automation
  • Performance doesn't matter

When to Use Wyn

  • Performance matters
  • Type safety matters
  • Systems programming
  • Concurrent workloads
  • Long-running services

Migration Path

Python developers will feel at home with Wyn's method syntax. The main adjustments:

  1. Add types to function signatures (but not variables, usually)
  2. Handle errors explicitly with Result/Option
  3. Think about ownership (though ARC makes this easier)
  4. Use pattern matching instead of isinstance checks

Wyn vs Rust

Similarities

  • Compiled to native code
  • No garbage collection
  • Result/Option for error handling
  • Pattern matching
  • Zero-cost abstractions

Differences

Complexity:

  • Rust: Steep learning curve, borrow checker, lifetimes
  • Wyn: Gentle learning curve, ARC, no lifetimes

Memory Safety:

  • Rust: Compile-time guarantees, no runtime overhead
  • Wyn: ARC has runtime overhead (reference counting)

Control:

  • Rust: Fine-grained control over memory
  • Wyn: Automatic memory management

Ecosystem:

  • Rust: Mature, large ecosystem
  • Wyn: Young, growing ecosystem

Code Comparison

Rust:

rust
fn process_data(data: &str) -> Result<Vec<String>, String> {
    let lines: Vec<String> = data
        .lines()
        .filter(|line| !line.is_empty())
        .map(|line| line.to_uppercase())
        .collect();
    Ok(lines)
}

Wyn:

wyn
fn process_data(data: string) -> [string] {
    var lines = data.split("\n")
    var result: [string] = []
    for line in lines {
        if not line.is_empty() {
            result.push(line.upper())
        }
    }
    return result
}

When to Use Rust

  • Maximum performance required
  • Embedded systems
  • Operating systems
  • No runtime overhead acceptable
  • Memory safety critical

When to Use Wyn

  • Faster development matters
  • Team has mixed experience levels
  • ARC overhead acceptable
  • Simpler mental model preferred

Migration Path

Rust developers will recognize many concepts. The main adjustments:

  1. No borrow checker - ARC handles memory automatically
  2. No lifetimes - simpler but less control
  3. Reference counting overhead - small but present
  4. Simpler syntax - less ceremony

Wyn vs Go

Similarities

  • Compiled to native code
  • Goroutine-style concurrency (spawn)
  • Channels for communication
  • Fast compilation
  • Simple syntax

Differences

Type System:

  • Go: Structural typing, interfaces
  • Wyn: Nominal typing, no interfaces yet

Object Model:

  • Go: Methods on types, but not "everything is an object"
  • Wyn: Everything is an object, method-first syntax

Error Handling:

  • Go: Multiple return values, manual checking
  • Wyn: Result type, ? operator

Generics:

  • Go: Added in 1.18, still evolving
  • Wyn: Built-in from the start

Code Comparison

Go:

go
func processFiles(paths []string) ([]int, error) {
    results := make([]int, 0)
    for _, path := range paths {
        content, err := os.ReadFile(path)
        if err != nil {
            return nil, err
        }
        results = append(results, len(content))
    }
    return results, nil
}

Wyn:

wyn
fn file_size_of(path: string) -> ResultInt {
    if not File.exists(path) {
        return Err("cannot read: " + path)
    }
    return Ok(File.read(path).len())
}

fn total_size(paths: [string]) -> ResultInt {
    var total = 0
    for path in paths {
        total = total + file_size_of(path)?
    }
    return Ok(total)
}

When to Use Go

  • Mature ecosystem needed
  • Cloud-native applications
  • Microservices
  • Large team, need simplicity

When to Use Wyn

  • Method-first syntax preferred
  • Type safety with less ceremony
  • Pattern matching needed
  • Cleaner error handling wanted

Migration Path

Go developers will recognize the concurrency model. The main adjustments:

  1. Method syntax - text.len() instead of len(text)
  2. Result type - instead of multiple returns
  3. Pattern matching - instead of type switches
  4. No interfaces (yet) - use concrete types

Wyn vs C/C++

Similarities

  • Compiled to native code
  • Systems programming capable
  • Manual control when needed
  • No runtime (minimal)

Differences

Memory Safety:

  • C/C++: Manual, error-prone, unsafe
  • Wyn: ARC, automatic, safe

Complexity:

  • C/C++: Complex, many footguns
  • Wyn: Simple, fewer ways to fail

Performance:

  • C/C++: Maximum performance
  • Wyn: Slightly slower (ARC overhead)

Development Speed:

  • C/C++: Slow, careful
  • Wyn: Fast, safe

Code Comparison

C:

c
int* process_data(int* data, int len, int* out_len) {
    int* result = malloc(len * sizeof(int));
    int count = 0;
    for (int i = 0; i < len; i++) {
        if (data[i] > 0) {
            result[count++] = data[i] * 2;
        }
    }
    *out_len = count;
    return result;  // Caller must free!
}

Wyn:

wyn
fn process_data(data: [int]) -> [int] {
    var result = []
    for (var i = 0; i < data.len(); i = i + 1) {
        if (data[i] > 0) {
            result.push(data[i] * 2)
        }
    }
    return result  // Memory handled automatically
}

When to Use C/C++

  • Existing codebase
  • Maximum performance critical
  • Embedded systems
  • Operating systems
  • Hardware interaction

When to Use Wyn

  • New projects
  • Memory safety matters
  • Development speed matters
  • Team productivity matters
  • Modern language features wanted

Migration Path

C/C++ developers will appreciate the performance. The main adjustments:

  1. No manual memory management - ARC handles it
  2. No pointers (mostly) - references are automatic
  3. No undefined behavior - compiler prevents it
  4. Modern features - Result, Option, pattern matching

Feature Comparison Matrix

FeaturePythonRustGoC/C++Wyn
Performance⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐
Memory Safety⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐
Learning Curve⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐
Concurrency⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐
Type Safety⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐
Ecosystem⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐
Compile TimeN/A⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐
Error Handling⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐

When to Choose Wyn

Choose Wyn when you want:

  1. Python's simplicity with C's performance
  2. Rust's safety without Rust's complexity
  3. Go's concurrency with better type safety
  4. Modern features without legacy baggage

Don't choose Wyn when you need:

  1. Maximum performance (use Rust or C)
  2. Huge ecosystem (use Python, Go, or Rust)
  3. Dynamic typing (use Python)
  4. Existing codebase (use whatever it's in)

The Sweet Spot

Wyn occupies the space between Python and Rust:

  • Easier than Rust but safer than Go
  • Faster than Python but simpler than C++
  • Modern features with practical tradeoffs

It's for developers who want to write fast, safe code without fighting the language.

Real-World Decision Making

Building a web API?

  • High traffic: Wyn or Go
  • Rapid development: Python or Wyn
  • Maximum performance: Rust

Building a CLI tool?

  • Simple: Python or Go
  • Fast startup: Wyn or Rust
  • Complex logic: Wyn

Building a system service?

  • Long-running: Wyn or Go
  • Resource-constrained: Rust or C
  • Team experience: Wyn (easier to learn)

Processing data?

  • Small data: Python
  • Large data: Wyn or Rust
  • Real-time: Wyn, Rust, or C++

Conclusion

Every language makes tradeoffs. Wyn trades maximum performance for simplicity, and maximum control for safety. It's designed for the 90% of cases where you need fast, safe code without the complexity of Rust or the unsafety of C.

Know your requirements. Choose accordingly.


For detailed language features, see Appendix A. For migration guides, see the main chapters.

MIT License - v1.19.1