Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initial draft of enhanced constructors proposal. #4245

Merged
merged 1 commit into from
Jan 31, 2025

Conversation

stereotype441
Copy link
Member

This proposal extends the set of actions that can be performed in the body of a non-redirecting generative constructor to include writing to non-late final fields and explicitly invoking super constructors.

This makes constructors more flexible, avoids the need for constructor initializer lists, and allows constructor augmentations to behave more consistently with function augmentations.

To preserve soundness, flow analysis is enhanced to ensure that a reference to this cannot escape from a constructor body before the object has been completely constructed.

Once this change has landed I will create the appropriate "feature" issue.


  • I’ve reviewed the contributor guide and applied the relevant portions to this PR.
Contribution guidelines:

Note that many Dart repos have a weekly cadence for reviewing PRs - please allow for some latency before initial review feedback.

@stereotype441 stereotype441 merged commit ebdb887 into dart-lang:main Jan 31, 2025
2 of 3 checks passed
@stereotype441 stereotype441 deleted the enhanced_constructors-2 branch January 31, 2025 19:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant