You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jan 25, 2022. It is now read-only.
Composition, mix-ins, etc is a natural feature of JS as dynamic language. How can prviate fields from this proposal used with dynamically composing a class?
Say, I have a class that have several utility fields and some mix-ins with functions that want to read private data - i.e. some generic logging and some mix-ins with functions that want to modify data - some generic normalization. Classes are not homogenic enough to throw everything into single base class and extend from there: I want different set of mixins in each class.
With read-only functions this can be somewhat "solved" with wrapper for each "external" function that would pass hidden field as argument, but this doesn't look very dynamic with lots of extra boilerplate in "host" class. Wrappers for R/W functions would be even more ugly with first passing everything that could possibly be needed in and then reading returns and writing them as necessary to hidden fields.
Is there a prettier and more natural solution for me as author of both "host" and "mixin" code?