High-Level Rust: Getting 80% of the Benefits with 20% of the Pain
8 hours ago
- #Developer Experience
- #Rust
- #Programming Languages
- The author has been searching for the perfect programming language but found none that fully meet all criteria: expressive types, good community, ecosystem, performance, and developer experience (devx).
- Previously using F#, TypeScript, and C#, each had trade-offs: F# has strong types but a small ecosystem; TypeScript has a large ecosystem but weak types; C# is solid but verbose and lacks features like native unions.
- Rust is appealing for its pros: high performance, expressive types, wide portability, large ecosystem, and stability. However, its cons include a steep learning curve and lower development velocity.
- The author proposes a 'High-Level Rust' approach to gain 80% of Rust's benefits with 20% of the pain, focusing on type-first domain modeling, functional-style logic with immutable data and cloning, and domain-driven design.
- This approach sacrifices some performance (10-30% slower due to cloning) but is suitable for applications like web APIs, business logic, and correctness-focused projects, while not ideal for hot paths or systems requiring peak performance.
- The author is developing 'LightClone,' a package to enforce cheap clones in Rust, and invites feedback to improve the approach and make Rust more accessible as a high-level language.