-
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
Finalize on
vs requires
for super mixins
#9
Comments
In the absence of concrete data to help us make a decision, I would prefer |
I'd be happy to put some time into crafting a survey to try to get some user feedback on this if that would be helpful. I'll need some sanity checking from @InMatrix to make sure I'm not doing something dumb, but I can do the manual labor. |
Thinking about this last night, there is a consistency argument for |
I'd be very happy to get some data on this, if we can do so very expeditiously. |
Yes, that was also part of the reason I like I'll try to come up with some kind of survey or something we could send out. |
Leaf and I spent a lot of time talking about this. I now have a much better understanding of how the I believe the typical mental model users have for mixins (if they have any model of them at all) is something like this: If you have some class that can X and a mixin that knows how to Y given an X, you can slap that mixin onto the class and now you have a class that can X and Y. I'm being hand-wavey about linearization here because I would bet good money that less than 10% of Dart users know anything about how mixins are linearized. So a typical mixin has some requirements and provides some capabilities. For example, ListMixin requires you provide If we use So, personally, I'm not enthused enough about Perhaps |
How about "extends"? |
Good suggestion. We talked about that too. It's technically feasible with the new syntax and I personally think it somewhat conveys the right thing. But I think it will really throw people off to see a mixin with an In class definitions, an There is a lot of overlap, but that leads me to worry that the two concepts are different enough that overloading the word will just sow confusion in both directions.
|
"extending" or "for" might also work. |
Let me know if you guys are still thinking about doing a survey about this choice. Given the subtle implications various word choices can have as discussed above, I doubt asking about the user's initial understanding of the proposed new syntax can resolve this issue. In addition to that, we probably need to present a few usage samples, and ask respondents if they believe the sample will be legal under the new mixin proposal or whether it does A, B or C. |
I think on balance, I don't think the price/performance tradeoff of doing a study here comes out well. This is a very new and different feature: as @InMatrix suggests, even to get to the point where we can get meaningful data from a user would require some investment in education. If there are no strong objections (and at this point I don't see any), I'd like to close this and move on with the existing syntax. |
👍 |
@Hixie About mixin ListMixin<E> on Iterable<E> {
...
}
mixin UnmodifiableListMixin<E> extends ListMixin<E> {
... throwing modifying methods ...
}
class MyUnmodifiableList<E> = MyIterable<E> with UnmodifiableListMixin<E>; |
Split off from #7 for continued discussion and resolution of the choice of syntax for the superclass constraints.
cc @Hixie @munificent @lrhn @InMatrix
The text was updated successfully, but these errors were encountered: