Yuescript
Yuescript copied to clipboard
Mixin Improvements: Override, super()
I would like added features for mixins to make them more inline with direct inheritance in terms if power and flexibility.
-
The ability to override mixed in fields and functions. Currently mixin functions take precedence over what are defined in the class including them, meaning you cannot override them.
-
The ability to call super() in an overridden mixed in function, to call the original implementation from the class it was from.
With these added features, mixins can be used more like proper interfaces with default implementations, and in some cases replace prototypical inheritance.
Fixed overriding in mixing, but do you have any idea to implement the super() function?
One idea is to keep a list of the class’ mixins. If super is called in a method, it can check the mixin list first before trying to call the parent.