dart-lang / dart-lang/language

Enhanced Default Constructors

Open
#698 17 comments 85 reactions 0 assignees View on GitHub
feature
Dominant language
TeX
Stars
2.9k
Forks
239
Avg merge
2d 18h
Merged PRs (30d)
14

Description

I propose to have default constructors
* automatically have named initialzing formal parameters for instance variables declared in the class (at least if they don't have initializer expressions).
* automatically forward parameters to accessible superclass generative constructors (when possible and not shadowed an the initializing formal with the same name introduced above).

This is a solution to #314 (allows you to declare classes with fields without having to write a constructor) and to #469 (forwards superclass constructor parameters). It might even be a solution for *some* parts of #367, but only in the simple cases where you don't need to do anything except storing the non-forwarded parameters.

([Initial design document](https://github.com/dart-lang/language/blob/master/working/0698%20-%20Enhanced%20Default%20Constructors/proposal.md)).

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.