IssueRaiser

Enhanced Default Constructors

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)).

Posted by lrhn on Nov 21, 2019, 1:06 PM

Tags

Related issues

Raise real-world problems, find people facing the same issue, and discuss solutions.3,500 issues0 comments

github (Software)

Enhanced Default Constructors

lrhnNov 21, 2019, 1:06 PM

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)).

Comments (0)

No comments yet. Start the discussion.

Comment on this issue