-
Notifications
You must be signed in to change notification settings - Fork 205
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
Implementation tracking/meta Issue for Super Mixins #12
Comments
I have added an initial cut on an implementation plan here. If you are an assignee of this bug, please review the implementation plan and the proposal itself (if needed), and provide any feedback and comments. If you see no technical issues with the proposal, and believe that the implementation plan is reasonable, please LGTM the plan here in the issue tracker. @a-siva for VM |
Hmm. I don't seem to be able to assign this issue to most of you, but if you're listed above, please take a look and sign off. |
I guess you could have made a "sign-off" PR and have us all approve. LGTM |
lgtm |
I believe @yjbanov has volunteered to do the Flutter migration. |
For Flutter our usual policy is to only allow one syntax at a time, and to require lints to force us onto the new syntax if we change the allowed syntax. I would feel more comfortable if Flutter was moved to the new syntax in phase 3 after the lint has been made available in phase 2. LGTM assuming that we do the migration on Flutter's side after we've got a lint to enforce it. |
@Hixie I'm happy to handle the migration however works best for you. My worry was/is this: I can't give you a lint to change a definition of a super mixin to the new syntax, because I have no way of knowing what things are super mixins until they are used. So the lint will fire on uses, not definitions. So I think it would be bad to land the analyzer hint that tells you are using an old style super mixin before we fix flutter. Otherwise users will see hints telling them to fix flutter... :) But we should be able to land them (essentially) simultaneously: migrate flutter to the new syntax and roll in a new analyzer with the hint. Or maybe we can roll in the new analyzer, but initially only turn on the hint inside of flutter? Does this seem reasonable? |
What we normally do is implement the lint, roll that, then turn on the lint and fix the bugs it finds at the same time (in a separate later PR). |
Based on the above discussion, we should also call out above the necessary work in the linter. |
If this is just about finding super mixin definitions in flutter, I'm not sure investing in a lint is worthwhile. I can find and fix all of the super-mixins in flutter independently. For flutter users, having a period where we a lint or hint fires is useful since it gives them time to make sure that packages get fixed. My only concern with doing this as a lint is that removing the lint after it has served its purpose is essentially breaking, right (because people might reference it in their analysis_options.yaml)? Whereas a hint (which has no external surface area) doesn't break anything if we remove it. Or does the analyze ignore unknown lint names? |
The analyzer ignores unknown lint names, except when explicitly analyzing the analysis options file, in which case an error is generated. |
Ok, SGTM. I'll put a linter issue up there and add that to the plan. |
The implementation plan mentions parsing in the CFE but not the analyzer front end. Is analyzer on the CFE now? Will we need to implement the syntax in the old analyzer parser? If we're only implementing this in the new front end, I need to make sure dartfmt is migrated to use analyzer+CFE. (Maybe there isn't any migration required and analyzer still exposes the exact same API and ASTs?) Aside from that, this LGTM. We'll want to get dartfmt support in pretty early because it will be hard for anyone to try the new syntax without that. I'll make it a priority. I don't see a TODO for tests. :) Who owns that? |
Analyzer on CFE will happen before Phase 0.
Language team will land an initial set of tests, co19 will land a more exhaustive set. I'll update appropriately. |
Not yet, no ...
... but we should be on the fasta parser by early next week (or maybe even the end of this week), so no.
Correct. When we move to the fasta parser (and later to CFE) the AST will not change. There might be a few minimal changes to the element model, but that won't effect dart_style.
I have a CL out to add the AST structures we'll need: https://dart-review.googlesource.com/c/sdk/+/70141. It's a breaking change, though, so I'm not sure exactly when we want to commit it. |
Sounds great, @bwilkerson! As long as there's a dartfmt tracking bug, I'll get it working with the new syntax once analyzer has the ASTs for it and is on CFE. |
Will you need a published version of analyzer to get started, or only after you're ready to publish dart_style?
And the fasta parser supports the new syntax (which will likely be a bit after analyzer is using the fasta parser). |
A published one, preferably. Otherwise, there is no easy way to run dart_style's tests in its own repo or on Travis. |
Oh I guess if the lint is only valid for a short time anyway because the whole syntax is going away, then that's fine too. No need for a lint at all then. Just make the change to the syntax and fix Flutter at the same time. Or whatever works for you. Just beware that for the span of time between fixing Flutter and making it impossible to do it wrong, there will almost certainly be people who check in the wrong thing accidentally. |
Actually, this raises a legitimate question. The old way of writing super-mixins is going away. But the old way of writing ordinary mixins will be supported indefinitely, and so there will be two ways to write a non-super mixin: using a mixin declaration or a class declaration. If Flutter wants to migrate to a single syntax for all mixins, then we probably do want a long term supported lint for this. @Hixie do you expect to want to migrate all mixins? |
Just to clarify from above, we expect the analyzer to be using the fasta parser shortly (there are two blocking bugs in the sdk repo, and we have to re-check the status of that change rolling into google3). Analyzer on the full CFE (including resolution, not just using the parser), has an ETA on the order of months. |
Or if we think that other users will want to use a single syntax :-) Even without a lint we ought to have "convert class to mixin" and "convert mixin to class" assists. |
I could imagine desiring a lint along the lines of "only mix in classes declared with We would probably just have a hack that requires that uses of the word "mixin" outside a comment are always followed by an identifier followed by the word "on", at least until we get a lint, to ensure that everything uses a single syntax. (We have many such tests already, e.g. one to verify we don't depend on package:test directly, one to verify that we are running the analyzer against the sample code in comments, one to verify that our internal imports don't form a cycle, etc.) |
This is consistent with our long term goals for the language, so how about we go with adding this lint to the analyzer in Phase 1, and then turning it on in flutter and fixing all the things in Phase 2? |
LGTM |
lgtm for ddc |
@leafpetersen, don't see any mention of rolling this into google3. Does it look like there will be no/few changes to the existing code base? |
@keertip This comment describes all uses in google3: #10 (comment) . I don't expect any difficulties. |
Implementation plan is reasonable for dartdoc. Typically with new language features dartdoc has to have some minor revisions (and new published versions of analyzer) to keep from crashing when encountering the new syntax. So there will be some distributed impact over the next few months. |
@JekCharlsonYu what remains on this feature? |
This issue is for tracking implementation of Super Mixins:
https://github.com/dart-lang/language/blob/master/accepted/2.1/super-mixins/feature-specification.md
TODO/Dependencies
on
vsrequires
for super mixins #9P0 Blockers
P1 Blockers
Non-Blockers
**Based on meta issue template
The text was updated successfully, but these errors were encountered: