-
Notifications
You must be signed in to change notification settings - Fork 2
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
Mixin arguments? #11
Comments
Mixin parameters are definitely useful in some cases, but I didn't include them yet in order to keep the proposal simple. You're right though, there's a pretty simple extension to allow parameters. |
@Dragoteryx Can you explain why the calling `let MyMixin = (superclass, arg1, arg2) => class extends superclass {
|
Taking a cue from decorators, wouldn't it make sense that the accepted value in the mixin position could either be a mixin itself ( |
Why?
The current way of creating mixins allows passing arguments.
However, this proposal doesn't include that functionnality, which I think is a shame as that would require us to use the old syntax when we want to use mixins with arguments.
It could be written this way:
The parenthesis would be optional if the mixin doesn't have any arguments. If the parenthesis are omitted even though the mixin has arguments then they would just be defined as
undefined
unless default values are defined. (similar to when using thenew
keyword)Composition
Extending a mixin that has arguments would look like this:
Which desugars to this:
Or like this:
Which desugars to this:
The text was updated successfully, but these errors were encountered: