3 ms·
I'm not familiar with React's mixins, but I get the impression from the suggestion to use higher order functions that it doesn't allow overriding methods from o
by mikegerwitz 10y ago
I'm not familiar with React's mixins, but I get the impression from the suggestion to use higher order functions that it doesn't allow overriding methods from other mixins. E.g. Scala's concept of stacking.
For those interested in the concept in JS, I implemented a full trait system in GNU ease.js designed around Scala's approach, with support for stackable traits. The system also supports protected/private properties and methods, which can also be taken advantage of in traits to provide public and protected APIs, and keep state encapsulated in traits. I don't have documentation available yet (soon), but I do have a great many test cases that demonstrate various aspects:
https://www.gnu.org/software/easejs/#traits https://www.gnu.org/software/easejs/#traits
https://www.gnu.org/software/easejs/news.html#d9b86c1 https://www.gnu.org/software/easejs/news.html#d9b86c1
Hopefully others find this to be interesting even if they don't agree with ease.js itself.