-
Notifications
You must be signed in to change notification settings - Fork 214
Discussion of cost of super mixin breaking change #10
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
Comments
Some initial data. Regexp based searching is somewhat unreliable for this, since it's a property of both the use and the definition of a class. I did some grepping of internal code and of github, looking for classes which had |
I also hacked the analyzer to look for
I downloaded the top 20 or so flutter/pub packages by popularity, and ran my hacked analyzer on them including the transitive closure of the dependencies and found no examples of super mixins defined outside of the flutter framework. I'll test out more packages from github, suggestions on other code bases to run on, or other ways of finding code to test out? After a bit more independent poking, I would like to propose that I mail flutter-dev:
|
SGTM. |
If we really can't find any uses of super mixins outside of the two (is that all?) classes in Flutter, does this feature really carry its weight? Could those mixins in Flutter be changed to use explicit delegation instead and then we get a simpler feature? I think dedicated mixin syntax is still a good idea, but that would let us sidestep all of the confusing semantics and syntax around specifying the superclass constraints on the mixin, and avoid the implementation and code size challenges of implementing mixins that contain super calls. |
There are more than two. Here's a few examples: I also estimated about 80 usages just inside the framework and core widgets. I don't have an estimate for user code. Update: removed |
Yeah we use this a lot. I also use it in my private code at home, though that obviously won't show up on the radar. I suspect people outside of the Flutter team don't use it because nobody knows about it, not because it's not desireable. It's a great feature. |
Thanks, @yjbanov! I was only aware of the ticker ones. |
Ok, an update. I've added an additional check to my hacked analyzer to look for mixins of classes that have something other than I've downloaded the first 6 pages of flutter packages from pub, ordered by popularity (see list below), and run my hacked analyzer on the lib, test, and example directories where relevant. For the I'm running the analyzer with I haven't found any definitions of super mixins. I see the following super mixins from the flutter repo referenced:
Some sanity checking with grep doesn't find anything with I don't like that I'm not getting to see any application code (just libraries). I'll be running this on internal code overnight, which should give us some coverage, and as discussed above, will solicit example applications to test out on flutter-dev. Packages examined so far are here:
|
Correct. |
Ok, we have our first winners! dartdoc, file, and charts_flutter all use super mixins. Interestingly neither of the first two actually uses The dartdoc package (cc @jcollins-g) seems to define one super-mixin here: The file package (cc @tvolkert) defines several around forwarding, here (ForwardingFile, ForwardingDirectory, ForwardingLink): The charts_flutter package has at least one definition (FlutterPanBehavior) here: The charts_flutter example is the only one I've found so far that actually uses super calls in a mixin. |
Yep, |
@leafpetersen good catch! |
I'm actually surprised to see any usage outside Flutter, given that this isn't documented at all as far as I know. |
Me too. :) Ok, I've run a global presubmit on internal code. The only definitions of super mixins that I see are in file, charts_flutter, and flutter. Externally, there's dartdoc as well. The file examples seem fully compatible with the super mixin proposal. There are no incompatible uses of the The charts_flutter example (FlutterPanBehavior) is used internally in a way that is mildly inconsistent with the proposal (it is instantiated as a class here: https://github.com/google/charts/blob/master/charts_flutter/lib/src/behaviors/zoom/pan_behavior.dart#L47), but this is trivial to fix internally there, and there are no uses on github at all outside of the package: https://github.com/search?q=FlutterPanBehavior&type=Code . I think this is looking quite good in terms of breaking change cost. I'll mail out to flutter-dev today soliciting additional feedback and examples. |
Just a note: I searched github for |
Mail to flutter-dev went out here: https://groups.google.com/forum/#!topic/flutter-dev/dU6rwPVO-WA . |
Should we record somewhere that Flutter currently ignores |
@leafpetersen I think we can close this now? |
Closing this, since this feature has landed. |
No description provided.
The text was updated successfully, but these errors were encountered: