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

Update specification for generative constructors #4192

Merged
merged 2 commits into from
Dec 6, 2024

Conversation

jakemac53
Copy link
Contributor

This is a paired down version of #4164.

It contains only the changes to the proposal we had previously discussed, making augmented have no special meaning in generative constructor bodies.

It does not change rules around initializing formals or super parameters (these must be consistent across the introductory and any augmenting declarations still).

I wanted to separate out this change from the much more complicated explanation of how these constructors should be evaluated.

@jakemac53 jakemac53 requested a review from eernstg December 3, 2024 16:31
Copy link
Member

@eernstg eernstg left a comment

Choose a reason for hiding this comment

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

LGTM!

@@ -932,8 +907,12 @@ potentially non-redirecting property of the constructor.

It is a compile-time error if:

* The augmented constructor has an initializer list or a body, or it has a
redirection.
* The augmented constructor has any initializers.
Copy link
Member

Choose a reason for hiding this comment

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

An initializer list can contain assertions, a superinitializer, and elements of the form n = e or this.n = e. If 'initializers' are only the third kind then we should consider adding the others explicitly.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is intended to cover all 3 forms (afaik a redirecting constructor cannot contain any of those?)

working/augmentation-libraries/feature-specification.md Outdated Show resolved Hide resolved
Co-authored-by: Erik Ernst <eernst@google.com>
@jakemac53 jakemac53 merged commit 9f594ce into main Dec 6, 2024
3 checks passed
@jakemac53 jakemac53 deleted the generative-constructors branch December 6, 2024 16:14
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.

2 participants