A Gopher Meets a Crab
2 days ago
- #Go
- #Rust
- #Programming Languages
- The author, a long-time Go developer, shares their first serious experience with Rust while building a chat server demo, guided by an AI (Claude), for a conference.
- Rust's exhaustive enums are praised for eliminating the need to manually check all variants, a feature missing in Go that typically requires code generation or tests.
- The '?' operator in Rust simplifies error handling compared to Go's verbose 'if err != nil' pattern, though it can make return paths less explicit.
- Complex nested matches and generics in Rust, such as async function signatures, were challenging and highlighted differences in language design philosophy.
- Rust's async runtime is external (like Tokio), requiring explicit library imports, unlike Go's built-in goroutines and scheduler, which are more implicit.
- Tools like tokio-console provide real-time monitoring of Rust's async runtime, similar to Go's pprof, but with live-tail capabilities for tasks and channels.
- Despite appreciating Rust's features, the author remains comfortable with Go for daily work due to its trade-offs, but acknowledges potential future adoption of Rust.