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

Can't use mixins with classes that have named arguments #25742

Closed
Hixie opened this issue Feb 9, 2016 · 4 comments
Closed

Can't use mixins with classes that have named arguments #25742

Hixie opened this issue Feb 9, 2016 · 4 comments
Labels
area-language Dart language related items (some items might be better tracked at github.com/dart-lang/language). type-enhancement A request for a change that isn't a bug

Comments

@Hixie
Copy link
Contributor

Hixie commented Feb 9, 2016

In Flutter we use named arguments heavily. The fact that we can't use mixins when the superclass has named arguments is a major problem that keeps getting in our way.

It's not clear why named arguments would be a problem. Just forward the constructor "super" call past the mixin.

@rmacnak-google rmacnak-google added the area-language Dart language related items (some items might be better tracked at github.com/dart-lang/language). label Feb 16, 2016
@lrhn
Copy link
Member

lrhn commented Feb 17, 2016

I assume it's the superclass constructors that can't have named parameters?

It seems like an oversight that only constructors with no optional parameters (positional or named) are forwarded. I can't see a practical problem preventing it.

@Hixie
Copy link
Contributor Author

Hixie commented Feb 17, 2016

class A { A({ bool hello }); }
class B { }
class C extends A with B { }

=> This mixin application is invalid because all of the constructors in the base class 'A' have optional parameters.

@floitschG
Copy link
Contributor

Duplicate of
#19226
#17610

and ultimately
#15101

Also dart2js supports it (contrary to the spec, but showing that implementation wise it's feasible), but the VM doesn't.

@kevmoo kevmoo added type-enhancement A request for a change that isn't a bug and removed type-enhancement labels Mar 1, 2016
@Hixie
Copy link
Contributor Author

Hixie commented Mar 19, 2018

See #31543 for the current status of this bug.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-language Dart language related items (some items might be better tracked at github.com/dart-lang/language). type-enhancement A request for a change that isn't a bug
Projects
None yet
Development

No branches or pull requests

5 participants