Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Facet relationship between parameterized types #900

Merged
merged 1 commit into from
Oct 19, 2021
Merged

Facet relationship between parameterized types #900

merged 1 commit into from
Oct 19, 2021

Conversation

josh11b
Copy link
Contributor

@josh11b josh11b commented Oct 19, 2021

No description provided.

@josh11b josh11b requested review from a team as code owners October 19, 2021 20:20
@google-cla google-cla bot added the cla: yes PR meets CLA requirements according to bot. label Oct 19, 2021
@josh11b josh11b requested a review from zygoloid October 19, 2021 20:20
@josh11b josh11b merged commit a97a017 into carbon-language:trunk Oct 19, 2021
@josh11b josh11b deleted the facets branch October 19, 2021 20:57
josh11b added a commit that referenced this pull request Jan 6, 2022
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](#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 <[email protected]>
Co-authored-by: Richard Smith <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes PR meets CLA requirements according to bot.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants