6 comments

[ 4.5 ms ] story [ 26.3 ms ] thread
FWIW, the thing that was confusing here didn't really have anything to do with async/await: it was all thanks to +=... which was hilariously also the source of a major issue recently found in Java 9/10. I am honestly starting to become a bit terrified of += :(.

https://news.ycombinator.com/item?id=17238015

They are not equivalent scenarios, which the article explains. The JS one is about asynchronous isolation context while the java one is just a evaluation bug.
Well, considering `x = x + await 2` and `x = await 2 + x` produces different behavior, it is more related to async/await than to the `+=` operator!
am I the only one that would answer that question with "this code is evil and you should feel bad" ?
The fun thing about this is that you're not expecting this code to be bad, I don't feel like it's wrong to expect the same behavior with and without the `await`