Improve associated type ergonomics
Nobody has claimed this yet.
- Dominant language
- Markdown
- Stars
- 6.6k
- Forks
- 1.7k
- Avg merge
- 16h 14m
- Merged PRs (30d)
- 1
Description
While we have a shorthand notation Iterator<Item = MyType> for specifying an associated type, it's still more verbose than input types. It may be worth adding support for positional specification of associated types, so that Iterator<MyType> works. There are at least two difficulties/drawbacks:
- This should be done in a way that still allows for new, defaulted input types to be added to a trait without breaking existing code.
- This might make the order of items within a trait significant, which has no precedent elsewhere in the language.
It's possible for a design to avoid both pitfalls, but the complexity may not be worth it.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with issue #585 and review the examples for positional associated-type syntax, including Iterator<Item = MyType> and Iterator<MyType>. Evaluate whether a proposal can preserve compatibility when defaulted input types are added and avoid making trait item order significant. Done means a resolved design, or a documented conclusion that the added complexity is not worthwhile.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- compilers
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100