Message from JavaScript discussions
April 2017
— In terms of the syntax required ie private
vs manual scope restrictions
You manually define an interface which reveals the modules you want to be public, through a publics
object or just returning a literal
— For me good class syntax would trim hundreds of lines of code by not requiring that
— And it will be more familiar to new commers from java and others
— 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?