Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
I tried replying to this post before it was made, but all I got was a 418 reply.
-
@Lensflare I shit you not, I recently looked fucking everywhere for about a day for a bug that involves asynchronous JavaScript.
I was missing a single. fucking. await.
Basically had a function x, that takes another function y as parameter. X returns a promise that'll resolve with the returned value of y() AFTER mutating the internal state of the class that contained function x.
...
let res = y();
//Mutate state
resolve(res);
...
All fine and good, but one time I didn't think straight and passed an async function as parameter y, which then caused the whole shebang to go haywire because
let res = y()
Obviously didn't await the completion of y().
Now it's
let res = await y();
And it cost me almost a full day at work.
Fuck. -
@Ranchonyx That’s why I call JS a clown language. Because a sane language wouldn’t let you compile code without an await on an async function. Or at the very least give you a warning.
-
@Lensflare yep. I would agree, see the thing is, I really like JS for that fact that it let's you mess around a lot and do things in almost any way you like. Since that even happened I've however partly switched to typescript because it quite literally makes JS not shit and tells you when something is likely to fuck up during runtime.
-
@Ranchonyx Let’s agree that TS makes JS better and disagree on the "not shit" part 😄
-
@Lensflare Hmm, whatever I'll yield for now, you've got a good point. Better it is.
Related Rants
it sucks!
Fuck asynchronous code because
joke/meme
asynchronous