-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Which contexts support implied constraints? #3256
Comments
I don't think we want this. |
It'd be equivalent to |
Here is the relevant section: https://github.com/carbon-language/carbon-lang/blob/trunk/docs/design/generics/details.md#interface-requiring-other-interfaces-revisited . That section doesn't seem to have examples using associated facets directly. It definitely seems possible to support I should probably add a clarification to the document about whether associated facets count as |
Summary of issue:
Currently, the only place the design says we support implied constraints is in generic function signatures:
But there are other places where allowing implied constraints would make sense and would improve expressivity and/or reduce redundancy. Do we want implied constraints to be limited to function signatures or to be more general?
Details:
For any kind of parameterized entity, implied constraints could make sense as constraints on the parameters:
For a parameterized
impl
, implied constraints could make sense, as constraints on the deduced parameters:Within an interface definition, implied constraints could make sense as
require
clause constraining implementations:Any other information that you want to share?
This review comment shows a case where we may gain some expressivity if we use implied constraints within an interface:
The text was updated successfully, but these errors were encountered: