-
Notifications
You must be signed in to change notification settings - Fork 13.1k
Closed
Labels
DuplicateAn existing issue was already createdAn existing issue was already created
Description
Following the mixin sample from here, I propose a new keyword for implementing mixins. The goal is to keep the code as clean as possible by letting the compiler know that applyMixins has to be included in the codebase and it must be called. Let's say the keyword is 'mixin', the aforementioned example would then be brought down to
class SmartObject mixin Disposable, Activatable {
constructor() {
setInterval(() => console.log(this.isActive + " : " + this.isDisposed), 500);
}
interact() {
this.activate();
}
}
An alternative way to declare it in order to avoid confusion with implements/extends:
class SmartObject {
mixin Disposable
mixin Activatable
constructor() {
setInterval(() => console.log(this.isActive + " : " + this.isDisposed), 500);
}
interact() {
this.activate();
}
}
The compiler would then add the applyMixins function and call it as shown in the article.
Metadata
Metadata
Assignees
Labels
DuplicateAn existing issue was already createdAn existing issue was already created