Message from JavaScript discussions

June 2017

— Once this gets gc'ed, { value: 42 } can also be safely gc'ed

— 

Here it is btw https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/getOwnPropertySymbols

— Well shit

— Anyways, that's the two ways I know of to shim private vars

— It seems we both surprise each other right now! XD

— Nothing outside this scope has access to the weakmap, hence private vars

— Anyways, what you said makes sense, that the new keyword would not neccesarily introduce any bad things or cons.

Message permanent page

— Although just doing closures is way easier

— It always is. More developers should take advantage of (abuse!) JS scoping rules

— 

const createInstance = function () {
const priv = { value: 42 };
return {
digitSum () { ... }
};
};

— Just way way simpler

— Agreed