Message from JavaScript discussions
April 2017
— 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
— Symbols must be stored, managed, and referenced in a chunky looking key system that doesn't make sense considering any external accessor can literally just pull up the symbol table
— In other words, it is more code for no good reason in terms of hiding members
— And if you have cross scope references to internal members of an object anyways, you might as well just give the accessor a reference to those members instead of the symbol