3 ms·
Yet, if you are making an interactive application, that easy to test codepath is a great way to put bugs into your requirements.
by marcosdumay 6y ago
Yet, if you are making an interactive application, that easy to test codepath is a great way to put bugs into your requirements.
- orisho 6y agoIn Go, it is a single code path. Contexts can be canceled and they also come with propagating timeouts. The timeouts simply trigger a cancellation, so the only code path is handling cancellation. There's nothing complicated about it, so there's no reason your code can't implement timeouts and cancellation the same way: timeouts are a cancellation triggered autonomously after some time passes.
- RhysU 6y agoNot disagreeing, but having trouble seeing it. Could you elaborate?
- marcosdumay 6y agoBy adding that timeout you just created a user-visible behavior that nobody asked for and people will only notice in production while dealing with the most complicated use-cases.
- RhysU 6y agoNobody asks for it but some choice must be made. As a user, I have often cursed things that hang indefinitely. And I don't trust application state after touching a cancel button. That stuff is seldom tested well.