mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-11-21 21:46:39 +00:00
There were some concerns about facet types leaking out of generic code in return types. Some initial fixes for this were done in [PR #900](https://github.com/carbon-language/carbon-lang/pull/900), but there remain concerns, for example when associated types are involved. In particular, given an interface method with return type using an associated type, as in: ``` interface Deref { let Result:! Type; fn DoDeref[me: Self]() -> Result; } class IntHandle { impl as Deref { let Result:! Type = i32; fn DoDeref[me: Self]() -> Result { ... } } } ``` Since `Result` has type `Type`, we had the problem that `IntHandle.DoDeref` would have to return `i32 as Type`, instead of the desired `i32`. We also think we can simplify the model by eliminating the facet type concept and syntax. This proposal removes facet types, introduces archetypes in their place, clarifies how associated types work outside of a generic function, and specifies how a generic `let` statement in a function body works. Co-authored-by: Wolff Dobson <wolffg@users.noreply.github.com> Co-authored-by: Richard Smith <richard@metafoo.co.uk>
Proposals
Proposal lists
Directory structure
This directory contains accepted proposals for the carbon-lang repository. For information about declined/deferred proposals, please view the proposal's original pull request.
For accepted proposals, where #### is the corresponding proposal's pull
request:
p####.mdwill contain the main proposal text.p####may be present as an optional subdirectory for related files (for example, images).