Message from JavaScript discussions
April 2017
— I see, just closures as private scopes
Right yes currently there is a lot of Object.assign
and other such object management required along with manually restricting or opening up scopes to share members
— The provided class syntax falls flat when it comes to extending
— I found an example I wrote awhile ago
—
function myClass () {
var self;
var myObj = {
combined: self,
privates: {
prop: "Hello World"
},
publics: {
prop: "Sup Bro"
}
};
self = Object.assign({}, myObj.privates, myObj.publics);
return myObj;
}
— This is my variant of that pattern, not exactly the same and saves some time
— This because js is basically a prototyping object oriented language
— (cb) => Promise.resolve().then(cb)
This? Or I miss understand?
— Have you used Symbols?
— Yep, Symbols are nearly useless
— There is only a very small set of niche use cases for them
— When it comes down to it you will spend just as much effort managing your symbols as you did manually managing references and scope