News for hackers. Stuff that matters.
Re:Let’s make a JavaScript Wait function by ajkjk on Sunday November 12, 2017 @05:06PM (#15682884)
I love async/await, but it's not because it's "aesthetically pleasing". It's because having execution jump around from the outer body to the inner anonymous functions fucks with all my intuition and, especially, with the way debuggers work.

If I want a series of steps to execute in order, I should be able to write them down in sequential lines of code, and it's, imo, a historical artifact that I was ever not able to do that -- because (oops), JS was traditionally conceived to have sequential lines of code execute immediately after each other, instead of blocking until they're able to proceed.

That is, it's not required that "single threaded language" meant "non-blocking execution" and thus required "callbacks and promises to do asynchronous behavior". It just ended up that way -- and we're finally (almost) free of it.

Re:Let’s make a JavaScript Wait function by always_good on Sunday November 12, 2017 @06:39PM (#15683180)
Thinking that it's a historical accident that everything is async in Javascript is a fundamental misunderstanding of async-everything.
Re:Let’s make a JavaScript Wait function by ajkjk on Tuesday November 14, 2017 @02:09PM (#15698155)
Want to elaborate? I disagree, but I'm happy to be corrected. Anyway, what I said was that it's a historical artifact that JS has a single thread of execution, and by that I meant, "it was standard to do that at the time that JS was conceived, so that's how it was done". If you were inventing web browsers today I don't think you'd ever intentionally choose to do it that way.
Re:Let’s make a JavaScript Wait function by z3t4 on Monday November 13, 2017 @08:10AM (#15686264)
I think jumping between functions makes JS fun :P It really clicked with me when I learned how closures work, and to use named functions.