mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-09-24 19:40:10 +01:00
Update the orphan rule to require a name to be defined within, or by, the same scope as the impl declaration. Since libraries can not be nested, this also enforces the old rule, but rejects more impl declarations. In particular, it rejects an impl declaration in a generic context which would have no way to provide a value for the generic bindings it inherited from its enclosing scope, making the impl unusable. Discussed in open discussion [2026-05-04](https://docs.google.com/document/d/1mjllGO3ZCL4qGt9uJHUtcxKoHAGEY7Y999ie4EtBWB8/edit?tab=t.3ifnhz83n73d#heading=h.p45zfugbmdih).
Generics
This directory contains the collection of documents describing the generics feature of Carbon:
- Overview - A high-level description of the generics design, with pointers to other design documents that dive deeper into individual topics
- Goals - The motivation and principles guiding the design direction
- Terminology - A glossary establishing common terminology for describing the design
- Detailed design - In-depth description
- Appendix: Coherence - Describes the rationale for Carbon's choice to have coherent generics, and the alternatives.
- Appendix: Rewrite constraints - Describes the detailed rules governing rewrite constraints, and why resolving them terminates.
- Appendix: Witness tables - Describes an implementation strategy for checked generics, and Carbon's rationale for only using it for dynamic dispatch.