dart-lang / dart-lang/language
Multiple upper bounds
- Dominant language
- TeX
- Stars
- 2.9k
- Forks
- 239
- Avg merge
- 2d 18h
- Merged PRs (30d)
- 14
Description
I need to implement a solution using generics that implements 2 interfaces, but as far as I can tell, generics in dart only supports 1 upper bound?
The contents of the 2 interfaces is not really relevant, and what I'm trying to do, is construct a class that can process this in generic form.
What I want is something like this:
```
abstract class RawRepresentable {
T get rawValue;
}
extension EnumByRawValue> on E {
// compile error
}
```
I know this is possible in both Typescript and Java, but I'm fairly new at Dart. Anyone know?
Contributor guide
Research direction
No files, tests, or entry points are named. Start by reviewing the proposed Dart generic extension syntax and the surrounding language-design discussion; done would require a resolved decision on whether multiple upper bounds should be supported and what syntax or specification change follows.
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