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

associated type syntax mismatch between PR 731 and the design docs #1099

Closed
jsiek opened this issue Feb 24, 2022 · 7 comments
Closed

associated type syntax mismatch between PR 731 and the design docs #1099

jsiek opened this issue Feb 24, 2022 · 7 comments
Assignees
Labels
inactive Issues and PRs which have been inactive for at least 90 days.

Comments

@jsiek
Copy link
Contributor

jsiek commented Feb 24, 2022

In PR 731 (https://github.com/carbon-language/carbon-lang/blob/trunk/proposals/p0731.md#syntax-for-associated-constants) it says that the syntax for specifying an associated type for an impl is to use let. As in the following example:

class DynamicArray(T:! Type) {
  ...
  impl as Stack {
    let ElementType:! Type = T;
    ...
  }
}

However, in the design documents (https://github.com/carbon-language/carbon-lang/blob/trunk/docs/design/generics/details.md#associated-types), there's this example that is using a where clause to specify an associated type:

  impl as StackAssociatedType where .ElementType = T { ... }

Which one of these is correct?

@jonmeow
Copy link
Contributor

jonmeow commented Feb 24, 2022

Just to note, that example is from #1013 "Generics: Set associated constants using where constraints" -- the let example is more likely outdated here.

@jonmeow
Copy link
Contributor

jonmeow commented Feb 24, 2022

I don't see "let ElementType:! Type = T;" in the current design. I think the design is correct here, and reflects the proposal evolution.

@jsiek
Copy link
Contributor Author

jsiek commented Feb 25, 2022

Ok, then the link to outdated rationale should be removed.

@chandlerc
Copy link
Contributor

Yeah, the design here changed in #1013 to use where clauses rather than the syntax in PR 731. @josh11b to maybe help track down any lingering bits of the design that need updating to reflect this.

@jsiek
Copy link
Contributor Author

jsiek commented Feb 25, 2022

On further thought, I'm concerned about this change to using where clauses to satisfy associated type requirements. I've posted a note explaining why on the #generics channel.

@josh11b
Copy link
Contributor

josh11b commented Feb 25, 2022

#731 is out of date, superseded by #1013 . Is there text in the design doc that I missed updating that I should fix, other than the text in https://github.com/carbon-language/carbon-lang/blob/trunk/proposals/p0731.md ?

@github-actions
Copy link

We triage inactive PRs and issues in order to make it easier to find active work. If this issue should remain active or becomes active again, please comment or remove the inactive label. The long term label can also be added for issues which are expected to take time.
This issue is labeled inactive because the last activity was over 90 days ago.

@github-actions github-actions bot added the inactive Issues and PRs which have been inactive for at least 90 days. label May 27, 2022
@josh11b josh11b closed this as completed Aug 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
inactive Issues and PRs which have been inactive for at least 90 days.
Projects
None yet
Development

No branches or pull requests

4 participants