Message from JavaScript discussions

April 2017

— It is a matter of verbosity


Tbh you should not want "real" classes in js because functions can stand in for anything under the sun and are more powerful. It is a level above classes. At the same time the only reason the es2015 spec introduced the class sugar/syntax is to allow a less verbose way of constructing class-like objects

— The es2015 class syntax is literally just a function anyways

— Also I see a lot of people using objects when they could use a monad, there is a lot of ignorance of how powerful js functions are

Message permanent page

— I will look over a article that stands for performance and said that `new` keyword on js is bad for performance because it binds an additional context to the execution of the statement, and then often discarded. That's because you should use `Promise.resolve` instead of making an instance with `new Promise`

Message permanent page

— I dont use new myself

— Although I haven't seen it eschewed with promises

— Using Promise.resolve vs new Promise cause entirely different control flow btw

— Any then methods will be invoked right away vs waiting for the promise function to throw resolve itself

Message permanent page

— Can't use Promise.resolve everywhere though

— Why's that?

— So why do you want real classes?