Closed
Description
This is the dart2js-specific issue for #23770. That issue has the details.
Metadata
Metadata
Assignees
Type
Projects
Milestone
Relationships
Development
No branches or pull requests
This is the dart2js-specific issue for #23770. That issue has the details.
Activity
allow super() calls
) #23770mit-mit commentedon Sep 16, 2015
@sigmundch, can we pull this back to 1.13? It's needed to complete #23770
sigmundch commentedon Sep 17, 2015
Hi @mit-mit, it might be tight for 1.13, which is why I thought was better to push it for 1.14 - @rakudrama was planning on tackling this but he can't get started right away. I'd be happy to chat in more detail if you like.
rakudrama commentedon Sep 17, 2015
This is definitely a post- 1.13 feature.
Features that involve mixins are always complicated. Mixins have proven to
be one of the most expensive features of Dart. It is best to assume it will
take two release cycles from commitment to get it working correctly.
There are unresolved problems with the proposal. The main one is that it is
not possible to efficiently implement mixin super calls in JavaScript when
one class is mixed-in more than once in an inheritance chain. I don't want
to agree to implement anything unless either (1) multiple mixins of the
same class (directly or indirectly) are forbidden, i.e. an compile-time
error in all implementations, or (2) someone convinces me how to implement
the feature.
On Wed, Sep 16, 2015 at 9:05 PM, sigmundch notifications@github.com wrote:
mit-mit commentedon Sep 17, 2015
@gbracha, can we forbid multiple mixins of the same class? Or is there some legit reason to support that?
gbracha commentedon Sep 28, 2015
At the moment, one could easily add a restriction to ban duplicates. Long term this is undesirable however for the following reason:
People want to mix in entire chains of mixins (aka mixin composition) so they can easily get the complete behavior associated with a class. We don't support that yet, but it is part of the plan. Once you do that, the chains are much more likely to contain duplicates, and these must be retained in order to preserve the desired behavior (and no, you cannot choose to remove the duplicates, it's been tried and does not work). If we banned duplicates, it would not only disallow certain usages, but also violate encapsulation: a composite mixin might evoilve over time and duplicates might arise where there had been none before, breaking working code.
So at the moment, the issue is really one of implementation convenience. If we make it easier for, say, dart2js by banning duplicates, we add a burden on the VM to check for a situation it already supports. I lean toward doing things right the first time.
As for the claim that it isn't possible to implement it efficiently, that is false. It isn't as easy. The obvious strategy entails replicating mixed in methods and that adds a space penalty. But in fact, you can chhose to do that only when you actually have a duplicated method. That is very rare.
eernstg commentedon Sep 29, 2015
On Mon, Sep 28, 2015 at 7:21 PM, Gilad Bracha notifications@github.com
wrote:
best regards,
Erik Ernst - Google Danmark ApS
Skt Petri Passage 5, 2 sal, 1165 København K, Denmark
CVR no. 28866984
5 remaining items
mit-mit commentedon Mar 1, 2016
Clearing milestone flag as it's not clear when this work is happening
lrhn commentedon May 17, 2018
No longer planned in the proposed form.