6 ms·
> But it can change under your feet – someone might change a function to be async, that used to be sync, and now your code is broken. Someone might change a fu
by minitech 7y ago
> But it can change under your feet – someone might change a function to be async, that used to be sync, and now your code is broken.
Someone might change a function that returns a single value to return an array, and now your code is broken. Someone might rename the function, and now your code is broken. This is the nature of breaking changes, and the same solutions apply.
- mstade 7y agoYeah but that changes the semantics of the function, whereas `async` arguably just changes the mechanics. The promise itself is not interesting, it's whatever value it (eventually) returns. My point is that a language that had implicit await would let you go on making function as async as you want them to be, and callers would be none the wiser. It'd also allow the caller to decide when to run things asynchronously and even truly defer values, something which JS promises can't do since they immediately execute, but that's an altogether different discussion.