Skip to content

Conversation

@eernstg
Copy link
Member

@eernstg eernstg commented Nov 6, 2025

This PR eliminates the support for in-body declaring constructors in the feature specification about declaring constructors. It also changes the terminology to use 'primary' rather than 'declaring' about the newly introduced constructors, because all other kinds have been eliminated.

@eernstg eernstg marked this pull request as draft November 6, 2025 16:50
@eernstg eernstg marked this pull request as ready for review November 7, 2025 14:13
@eernstg
Copy link
Member Author

eernstg commented Nov 7, 2025

This PR deals with the comments from @lrhn on an earlier PR #4543, and it updates the primary constructor feature specification to eliminate everything associated with in-body declaring constructors.

The terminology now uses 'primary' everywhere, because that's the only new kind of constructor which is being added by this feature. I did not change the experimental flag because that's a transient and relatively hidden thing.

@eernstg
Copy link
Member Author

eernstg commented Nov 7, 2025

https://dart-review.googlesource.com/c/sdk/+/460420 updates the spec parser to use the new grammar rules, which serves as a sanity check on the grammar.

*For an extension type, this ensures that the name and type of the
representation variable is well-defined, and existing rules about final
instance variables ensure that every other non-redirecting generative
constructor will initialize the representation variable. Moreover, there
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(Are we sure there are such rules, and that they are not only defined for classes?)

Copy link
Member

@munificent munificent left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thank you for your endless patience dealing with the churn in this proposal. Our users will be better off for it.

@eernstg eernstg removed the request for review from leafpetersen November 10, 2025 12:43
@eernstg eernstg merged commit 027f3ed into main Nov 10, 2025
4 checks passed
@eernstg eernstg deleted the spec_no_inbody_nov25 branch November 10, 2025 12:44
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.

4 participants