dart-lang / dart-lang/language
(Proposal) Default constructor with arguments
- Dominant language
- TeX
- Stars
- 2.9k
- Forks
- 239
- Avg merge
- 2d 18h
- Merged PRs (30d)
- 14
Description
I believe allowing constructors with arguments to be default would save us a lot of typing and dead-weight code space.
```
class FieldModel {
FieldModel(Map data) {
...
}
}
class SealerModel extends FieldModel {
// SealerModel(Map data) : super(data);
}
```
Instead of the compile error I'd like that constructor to be picked up and used as default for the subclass.
`error: The superclass 'FieldModel' doesn't have a zero argument constructor. (no_default_super_constructor_implicit at ...`
Contributor guide
Research direction
Start with the constructor examples and the no_default_super_constructor_implicit diagnostic in the issue. Determine whether implicit subclass constructors may forward superclass arguments, then document the accepted semantics and resulting diagnostics; no file or test is named in the payload.
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
- 35/100