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

Add feature specification of static extensions #3835

Merged
merged 16 commits into from
Sep 15, 2024

Conversation

eernstg
Copy link
Member

@eernstg eernstg commented May 24, 2024

This PR adds a proposed feature specification of the 'static extensions' mechanism. For background, see #723. The proposal is mainly an excerpt from an earlier proposal about implicit construction (here).

@eernstg
Copy link
Member Author

eernstg commented May 31, 2024

Hi @stereotype441, I've extracted a proposal about extensions that are capable of adding static members and factory constructors to existing declarations that are where such members can be declared (classes, extension types, etc.).

I'd like to use an approach which is similar to what @munificent has done a few times for documents in 'working': The review would just be a brief sanity check, and then we'd handle all the discussions about details in separate issues here in the language repo.

There are two versions. One version introduces a new kind of declaration (static extension). I tend to prefer this, because the way the declaration uses the on-type in connection with constructors is so different from the way we're using the on-type of a normal extension with instance members. It is also an anomaly that we would need to allow the on-type to be an extension, because they can have static members, so we may want to add them.

The other version is a generalization of the extension declaration that we have today. This version has some other benefits: A rather large handful of things need not be specified in this variant, because we already have extension declarations, and they already have the rules we need.

Anyway, I expect that we'll have some really nice dog fights about this choice.

Could you take a look in order to have that brief sanity check?

Copy link
Member Author

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

Several changes introduced based on the review.

@eernstg
Copy link
Member Author

eernstg commented Aug 21, 2024

@lrhn, PTAL. I created an issue #4049 in order to discuss the main remaining language design question.

This PR does not update working/0723-static-extensions/feature-specification-variant1.md, it only changes variant2.

@eernstg
Copy link
Member Author

eernstg commented Aug 23, 2024

Thanks for the input on working/0723-static-extensions/feature-specification-variant1.md!

I actually hadn't planned to work on that document in this PR (because that document is nearly a copy-paste of https://github.com/dart-lang/language/blob/main/working/0107%20-%20implicit-constructors/feature-specification.md), but I'll go over it now. This means introducing into 'variant1' many of the improvements to 'variant2' which were suggested in reviews on this PR, because they are similar in so many ways. This might preempt some comments on 'variant1', but I'll try to keep track of it such that nothing in the comments is ignored.

@eernstg
Copy link
Member Author

eernstg commented Aug 23, 2024

NB: At this time, working/0723-static-extensions/feature-specification-variant2.md is in a reasonably good shape whereas working/0723-static-extensions/feature-specification-variant1.md needs to be revised (in ways that are similar to the changes made to 'variant2' recently).

Copy link
Member Author

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

I made some changes to '...variant1.md' in response to review comments.

Note that I still need to go over '...variant1.md' and make a lot of changes that are similar to the ones that I performed on '...variant2.md'.

@eernstg
Copy link
Member Author

eernstg commented Aug 30, 2024

Hi @leafpetersen and @lrhn, cc-hi @dart-lang/language-team. I'd like to land this now. I think it's better to take the remaining discussions via Github issues, and I also think the relevant issues have already been created. Then we can change these documents as needed later on, when the issues have been processed. WDYT?

Copy link
Member

@leafpetersen leafpetersen left a comment

Choose a reason for hiding this comment

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

I think we're at a point where the most productive thing is to land this as an interim state and move any remaining discussion to issues. LGTM to land as WIP.

@eernstg eernstg merged commit 324c701 into main Sep 15, 2024
3 checks passed
@eernstg eernstg deleted the spec_static_extensions_may24 branch September 15, 2024 10: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.

3 participants