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:
def process_files(paths):
results = []
for path in paths:
with open(path) as f:
content = f.read()
results.append(len(content))
return resultsWyn:
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:
- Add types to function signatures (but not variables, usually)
- Handle errors explicitly with Result/Option
- Think about ownership (though ARC makes this easier)
- 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:
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:
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:
- No borrow checker - ARC handles memory automatically
- No lifetimes - simpler but less control
- Reference counting overhead - small but present
- 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:
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:
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:
- Method syntax -
text.len()instead oflen(text) - Result type - instead of multiple returns
- Pattern matching - instead of type switches
- 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:
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:
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:
- No manual memory management - ARC handles it
- No pointers (mostly) - references are automatic
- No undefined behavior - compiler prevents it
- Modern features - Result, Option, pattern matching
Feature Comparison Matrix
| Feature | Python | Rust | Go | C/C++ | Wyn |
|---|---|---|---|---|---|
| Performance | ⭐ | ⭐⭐⭐⭐⭐ | ⭐⭐⭐⭐ | ⭐⭐⭐⭐⭐ | ⭐⭐⭐⭐ |
| Memory Safety | ⭐⭐⭐ | ⭐⭐⭐⭐⭐ | ⭐⭐⭐ | ⭐ | ⭐⭐⭐⭐ |
| Learning Curve | ⭐⭐⭐⭐⭐ | ⭐ | ⭐⭐⭐⭐ | ⭐⭐ | ⭐⭐⭐⭐ |
| Concurrency | ⭐⭐ | ⭐⭐⭐⭐ | ⭐⭐⭐⭐⭐ | ⭐⭐ | ⭐⭐⭐⭐⭐ |
| Type Safety | ⭐⭐ | ⭐⭐⭐⭐⭐ | ⭐⭐⭐⭐ | ⭐⭐⭐ | ⭐⭐⭐⭐ |
| Ecosystem | ⭐⭐⭐⭐⭐ | ⭐⭐⭐⭐ | ⭐⭐⭐⭐ | ⭐⭐⭐⭐⭐ | ⭐⭐ |
| Compile Time | N/A | ⭐⭐ | ⭐⭐⭐⭐⭐ | ⭐⭐⭐ | ⭐⭐⭐⭐ |
| Error Handling | ⭐⭐ | ⭐⭐⭐⭐⭐ | ⭐⭐⭐ | ⭐ | ⭐⭐⭐⭐⭐ |
When to Choose Wyn
Choose Wyn when you want:
- Python's simplicity with C's performance
- Rust's safety without Rust's complexity
- Go's concurrency with better type safety
- Modern features without legacy baggage
Don't choose Wyn when you need:
- Maximum performance (use Rust or C)
- Huge ecosystem (use Python, Go, or Rust)
- Dynamic typing (use Python)
- 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.