Jeff-Mott-OR
Jeff-Mott-OR
The "bad" example is correct, but admittedly I think [Robert Martin explained it better](https://drive.google.com/file/d/0BwhCYaYDn8EgNzAzZjA5ZmItNjU3NS00MzQ5LTkwYjMtMDJhNDU5ZTM0MTlh/view) by putting an assert in the code. void g(Rectangle& r) { r.SetWidth(5); r.SetHeight(4); assert(r.GetWidth() * r.GetHeight())...
**Better?:** ```javascript function divide(a, b) { if (b === 0) { throw new Error('Divide by Zero') } return a / b } // Use divide synchronously try { divide(1, 0)...
So it sounds like you want to Promise all the things? Every function should return a promise? Every error should be a rejection? > Also promises can't catch errors which...
That SE answer got it wrong. As do many, sadly, because of "exception"'s unfortunate name. Here's a quote from Bjarne Stroustrup, the guy who invented C++: > Given that there...
Straight from that article: > So, when do you use throw, and when do you use callbacks or event emitters? It depends on two things: > Is the error an...
An alternative that might make everyone happy is rather than focus on real vs fake, you could instead say that JavaScript's classes are different than Java/C++ but similar to Python/Ruby....
> ...and I guess in python/ruby... Yep. Couple minimal repl demos if you're curious. Python: https://repl.it/CmeW/0 Ruby: https://repl.it/CmeX/0 > If you remove the ability to dynamically mutate objects, I think...
Weren't our super calls _always_ statically bound? Even long before ES6? ``` var P = { foo: function() { console.log( "P.foo" ); } } var C = { foo: function()...
@atomiks Ideally the bloggers and YouTubers would take down their misinforming content. Until and unless they do that, unsuspecting newbies will continue to be infected with and spread that misinformation....
Closing for inactivity.