Hasty Briefsbeta

Bilingual

An Incoherent Rust

9 hours ago
  • #Coherence
  • #Rust
  • #Ecosystem
  • The Rust ecosystem faces challenges with foundational crates like serde, where implementing traits for types is required across the ecosystem, making it difficult to introduce alternatives.
  • Coherence and orphan rules in Rust enforce that a trait can only be implemented once for a type, preventing overlapping implementations and ensuring soundness.
  • Existing proposals to relax coherence and orphan rules, such as binary crate exemption, deferred coherence, and specialization, have limitations and don't fully solve ecosystem evolution problems.
  • A radical proposal suggests removing coherence by introducing named impls and trait bound parameters, allowing for overlapping implementations while maintaining soundness.
  • This approach could enable incoherent traits, where traits can have multiple implementations for the same type, addressing ecosystem evolution challenges.
  • The proposal also explores implications for soundness, the HashMap problem, and how trait bounds on types versus impls differ in this model.
  • Potential benefits include solving lifetime-dependent specialization, improving type system soundness, and enabling new language features like effect systems.
  • The transition to this model would require significant compiler changes and language design work, including syntax for named impls and migration strategies.