3 ms·
> promises start running upon creation... > ...until you submit it to an executor That's not much different. Don't call the function then which returns that p
by kowdermeister 7y ago
> promises start running upon creation...
> ...until you submit it to an executor
That's not much different. Don't call the function then which returns that promise :)
Or you can write:
sendRequest(thingThatReturnsPromise);
- steveklabnik 7y agoSure, it’s easy to remember once you know it. It’s a very common foot gun for the JS folks coming over, and can also affect how you structure your code because of it. Code that runs in parallel in JS will be sequential when naively translated. I’m in the process of writing a blog post about this...
- kowdermeister 7y agoThanks btw for the warning, I'm learning Rust slowly by going through the awesome Rust book.