dart-lang / dart-lang/language
Add infer keyword
- Dominant language
- TeX
- Stars
- 2.9k
- Forks
- 239
- Avg merge
- 2d 18h
- Merged PRs (30d)
- 14
Description
Let:
```
abstract class Entity {
T get id;
}
class EntityStore, K> {
T getById(K id) {
...
}
}
class Customer extends Entity {
final int id;
Customer(this.id);
}
```
Calling Code:
`final store = EntityStore();`
But type parameter `K` could already be inferred from `T`:
`final store = EntityStore(); // this doesn't work`
I propose `infer` keyword for type parameters that could be inferred from other type parameters:
`class EntityStore, infer K> {}`
Contributor guide
Research direction
Start with the examples in issue #2173 and read its 13-comment thread to understand the proposed infer keyword and the type relationship it targets. Done means the language design has a resolved decision and documented behavior for the EntityStore examples.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- dart
- Domain
- compilers
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100