Message from JavaScript discussions

April 2017

— 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

Message permanent page

— 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

Message permanent page

— 

const readFilePromise = (filename) => new Promise((resolve, reject) => fs.readFile(filename, (err, data) => {
if (err) reject(err);
else resolve(data);
}));


Can't use Promise.resolve instead of new Promise here

Message permanent page

— Any control flow which relies on the promise to be resolved as a matter of some async event being finished will not work... if the promise is resolved prior to that event finishing, which would be the case if you used Promise.resolve. Should be obvious to anyone who works with them routinely

Message permanent page

— Yeah

— I mean I've used pomises in non-async situations because they are a great way out of callback hell, so theres probably very good use examples for it

Message permanent page

— Ahhh

— Why would there be callbacks in non-async situations though...

— In systems design you may have an event bus